Allow to admin user to edit all events

Hello!
I’ve set extended private mode, to allow to users to modify only their events.
But I need that the admin usergroup, or only a particular admin user, can modify all the events.

No problem if there’s need to change code, I already did some customization about email notifier etc. etc.+

I think to insert, where the code check for the permission an “or” state like this

if ((userid == $user_id_event) || (userid == '65')) { allow etc. etc. }

But i can’t find where this control could be.

dhtmlxSchedulerConfigurator.php, line 1168

if ($this->settings["privatemode"] == "ext") { $user = $action->get_value('user'); if ($user != $this->userid) { $action->error(); } }

check against userid must be altered with “or $user = some”

line 931+

if (event.user == '".$this->userid."') {

must be altered with similar “or” instruction

Could either of you share what code change exactly would accomplish this?

Much appreciated. Thanks.

Hi,
this code is not actual for 3.0 plugin version. The best way would be to use “Administrator” user group to enable “Edit all” mode to someone.

I have the 3.0 version of the plugin, but the only user group options I see are “View” “Add” and “Edit”. There isn’t an “Edit all” option. Am I looking in the wrong place?

Thanks for your help.

You should enable Add and Edit checkboxes for administrator user group.

Well, what I really need is to allow one particular user, not just all admins, the ability to create & edit any event, and all other logged in users can create/edit only their own. Is that possible as is, or do I need to modify the plugin?

You need to set the private extended mode than make the change that radyno wrote.

I’ve set it to Private Extended Mode, but I don’t see any different options to enable one user more add/edit rights than any other. Is there something I’m missing? Here’s a screenshot: http://thegallerymusic.com/screenShot.png

You’ve done right but than you need to modify the code.
My calendar now works in the way you say.

In file dhtmlxSchedulerConfigurator.php i modify the bold part.
63 is the user ID of my admin.

[code]public function set_event_user($action) {
if ($this->settings[‘templates_username’] == ‘true’) $action->remove_field(‘1’);
$status = $action->get_status();
if ($status == “inserted”) {
$action->set_value(“user”, $this->userid);
} else {
if ($this->settings[“privatemode”] == “ext”) {
$user = $action->get_value(‘user’);
//MODIFICA CONTROLLO UTENTE
if (($user != $this->userid) && ($this->userid !=‘63’)) {

				$action->error();
			}
		}
	}[/code]

Than I modify this part in the same way

if ($settings["privatemode"] == "ext") { $scheduler .= "scheduler.attachEvent('onEventLoading', check_user);"; $scheduler .= "scheduler.attachEvent('onBeforeDrag', check_user_before_drag);"; $scheduler .= "function check_user_before_drag(event_id, native_event_object){ if (event_id == null) { return true; } var event = scheduler.getEvent(event_id); if ((event.user == '".$this->userid."') [b]|| ('".$this->userid."' == '63') )[/b]{ return true; } else { return false; } }"; $scheduler .= "function check_user(event){ if ((event.user == '".$this->userid."') [b]|| ('".$this->userid."' == '63') )[/b] { event.readonly = false; } else { event.readonly = true; } return event; }";

I can’t provide you the line cause I make other changes on code and probably my lines numbers are differt form yours.

Sorry we can’t see the bold.
Anyway this is the code I use.

Ok, thanks very much.

It’s still not allowing the one specified user to edit all events, but it is keeping the ‘private extended mode’ for all users. I’m using the s2member plugin and I think there may be a conflict with the user role names or something…?

Could it be that the custom role names we have for s2member (and with the setting checked to force WP to use those names) is not coinciding with the scheduler plugin to assign role rules? I’m not sure if the scheduler uses whichever role names are currently set, even if they have been set by something like s2member.

Any thoughts?

I don’t know…

I’m using only joomla user module and I make control on the user ID.

With extended private mode, and the code I give you, my admin user can edit ALL events… and normal users can only edit their own events.

I don’t know why you have this problem. Have you change the ID in the code?

Yea, I changed the ID. Still not working as it should.

This would be a great option to include in a new plugin update perhaps…? Until then, if anyone has any other ideas/thoughts, I’m all ears.

Thanks.

Hi,
unfortunately there is no way to customize it easy. Maybe it will be implemented in the next release.

Hello,

helpful post - looking for the same solution (user can edit own one, admit - all events)

Tried the posted above code change - > for admins looks to work.
Issue is with usual event author - this non admin user can change admin events and even delete it:
A. change - via text change button on the left event toolbar
B. delete - not directly via icon on the left toolbar, but by following steps: change text as stated above in A., stay on event and choose delete button on the left toolbar => event from admin will be deleted.

how to solve it? is the posted code “allows too much”?
Why toolbar is shown by admins’ events to non admins at all?

Thank you!

Hi!

need a help.
why the event side toolbar is shown for the non-author of the event - after code modification as stated above?

Thank you!

screenshot to the post above:
user logged in - test 1
but can click on events created by admin and acess the edit lefttoolbar: