Hello, On the code canyon comments page, you gave me some code to add to my theme's functions.php file that would allow me to display the calendar for the current logged in user.
Can you tell me what I need to do to assign each calendar to a user? Is it by making them the organizer? Do they need to be a certain WordPress role if they are only viewing events and not creating/editing (Subscriber, Editor, etc)? As the admin, I will be the only one creating and editing events. I just need a way to assign "John Smith's Calendar" to the wordpress user "John Smith" so when he logs in from the front end, he only sees the events that I have added to his calendar and not another user's.
Also, will this limit each user's ability to see other user's calendars and locations in the top filter bar?
Thank Thanks for the reply. I think I understand. I'm going to have around 100 calendars, so I'll just copy and paste and edit the lines that include the user ID and the calendar ID.
For the future, would there be any way for you to make a change to the plugin so instead of manually adding the code, the admin could just select a user from a drop-down menu within each calendar, which would assign the selected user to the calendar?
It's not working for me...Here's the code I added:
// Stache calendar plugin display calendar for each user add_filter('stachethemes_ec_atts', function($atts) {
$current_user = get_current_user_id();
switch($current_user) :
case 30: $atts['cal'] = 965; break;
case 20: $atts['cal'] = 970; break;
default: $atts['cal'] = '';
endswitch;
return $atts; });
I have wordpress user "30" associated with calendar "965" and wordpress user "20" associated with calendar "970". When these users log in from the front end, they are still able to see all events for all users.
For each calendar, front-end visibility is set to "logged-in users", back-end visibility is set to "administrators", and who can add events from front end is set to "administrators".
All of my users are "subscriber" users. I don't know if that has anything to do with it?
Do you have any feedback on if it would be possible to make it easier to manage this in the future by updating the plugin to allow users to select a wordpress user via a drop down or multiselect from each add/edit calendar screen?
Hello,
On the code canyon comments page, you gave me some code to add to my theme's functions.php file that would allow me to display the calendar for the current logged in user.
Can you tell me what I need to do to assign each calendar to a user? Is it by making them the organizer? Do they need to be a certain WordPress role if they are only viewing events and not creating/editing (Subscriber, Editor, etc)? As the admin, I will be the only one creating and editing events. I just need a way to assign "John Smith's Calendar" to the wordpress user "John Smith" so when he logs in from the front end, he only sees the events that I have added to his calendar and not another user's.
Also, will this limit each user's ability to see other user's calendars and locations in the top filter bar?
Thanks! Love the plugin by the way!
Assigning calendar to a user is done via the filter I've sent you:
I'll explain the code:
case 1: means "if the user id is 1"
will assign the calendar with id 1 to this user and the user will see only this calendar on the front-end.
So if you want to assign calendar with id #105 to the user with id 15. The code will be like following:
Calendar front-end visibility should be set to "Public" or "Logged in users".
Top filter bar will display only filters regarding events residing in this particular calendar.
Stachethemes Developer
Thank Thanks for the reply. I think I understand. I'm going to have around 100 calendars, so I'll just copy and paste and edit the lines that include the user ID and the calendar ID.
For the future, would there be any way for you to make a change to the plugin so instead of manually adding the code, the admin could just select a user from a drop-down menu within each calendar, which would assign the selected user to the calendar?
It's not working for me...Here's the code I added:
// Stache calendar plugin display calendar for each user
add_filter('stachethemes_ec_atts', function($atts) {
$current_user = get_current_user_id();
switch($current_user) :
case 30:
$atts['cal'] = 965;
break;
case 20:
$atts['cal'] = 970;
break;
default:
$atts['cal'] = '';
endswitch;
return $atts;
});
I have wordpress user "30" associated with calendar "965" and wordpress user "20" associated with calendar "970". When these users log in from the front end, they are still able to see all events for all users.
For each calendar, front-end visibility is set to "logged-in users", back-end visibility is set to "administrators", and who can add events from front end is set to "administrators".
All of my users are "subscriber" users. I don't know if that has anything to do with it?
Is it possible to provide me with wp-admin?
Stachethemes Developer
Could you check again now?
Stachethemes Developer
Works perfect! Thank you! What did you have to change to get it to work?
I forgot to add a check if there are any attributes with the shortcode beforehand.
Stachethemes Developer
Oh ok, awesome! Thanks so much!
Do you have any feedback on if it would be possible to make it easier to manage this in the future by updating the plugin to allow users to select a wordpress user via a drop down or multiselect from each add/edit calendar screen?
Yes, that will be done.
We're working on integrating OpenStreetMap along with own Comments/Ratings section and I will try to include this feature with the update.
Stachethemes Developer
Oh wow, that would be wonderful! Thank you for your quick replies and help! I'm glad I purchased your plugin!