-
Author
-
December 7, 2014 at 07:19 #37948Weird MikeParticipant
I know this may sound totally non-theme related, but I was wondering if anyone knew of a way to make a users role display a custom template depending on what it is. I would like to have a different CSS style sheet for my Admins, Moderators and users.
Also, with this option to have their posts show in the activity feed with different color backgrounds to show importance to other users.
December 7, 2014 at 13:50 #37979sharmstrModeratorDefinitely doable. I haven’t tried to do this, but the first thing that pops into my head is set up everything in Theme Options to what you want to display for users. Then in your childs functions.php file, add a function that will check to see if the logged in user is a moderator or an admin and load a custom css file if so. Something along the lines of (note, this is untested code)
COPY CODEif ( current_user_can( 'moderate' ) ) { wp_enqueue_style( 'moderator-styel', get_stylesheet_uri() ); } else if ( current_user_can( 'edit_posts' ) ) { wp_enqueue_style( 'admin-style', get_stylesheet_uri() ); }
Then to handle the styling by user type in the activity feed, you’ll have to copy the kleo/buddypress/activity/entry.php file to your child theme and edit it to get the activity user id. Once you have that you can see if the user is an admin or moderator and add different css classes to the divs you want to change.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 7, 2014 at 15:16 #37989Weird MikeParticipantOkay, so far the code hasn’t popped up any errors when added to my child theme’s functions.php file, but where is the enqueue getting the style sheet from if the
get_stylesheet_uri
defaults to pulling from wp-includes/theme.php ?And to be exact the roles I want to call custom style sheets for are Administrator & Vendor. The style sheet I added in the child theme’s main directory is vendor.css with some CSS edits but nothings being affected.
December 7, 2014 at 15:58 #37993sharmstrModeratorget_stylesheet_uri looks in your child theme. Read the codex: http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 11, 2014 at 14:48 #38577sharmstrModeratorWere you able to get this working?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 11, 2014 at 15:07 #38598Weird MikeParticipantI was not. I tried many different ways, but still nothing.
December 11, 2014 at 15:33 #38605sharmstrModeratorRespond privately with temp admin access and I’ll take a look if you’d like.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 11, 2014 at 16:10 #38622sharmstrModeratorIts because it can’t find your css file for 2 reasons.
1 – You used get_template_directory_uri instead of get_stylesheet_directory_uri like I mentioned. The get_stylesheet_directory_uri gets the dir path of your child theme.
2 – You also need to include a / as in ‘/admin.css’.
I’ve made the changes for you and its loading now.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 11, 2014 at 16:29 #38631sharmstrModeratorNo problem.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.