Forums

[resolved] Some tweaks that should be done (27 posts)

  1. blogspotmedia
    Member
    Posted 10 months ago #

    I would like to know if it is possible or if anyone know to do the following:
    1. In the contributor interface, the user role "contributor" has the ability to change the post statuses from the Quick Edit link. I wish to know if it's possible to remove that link for contributors so they will not be able to access it, see it, or execute it.
    2. Still remaining on the the contributor dashboard. I wish to know if it is possible also to remove the following info from viewing: The number of published articles, number of drafts and number of pending. When i mean removing, i mean to not see them in any way.

  2. deepbevel
    Member
    Posted 10 months ago #

    user-role-editor
    this allows you to customize access for each user roll.

  3. blogspotmedia
    Member
    Posted 10 months ago #

    I know that plugin, but it doesn't do the things i mentioned above, i think i will need someone that knows some code, would appreciate a lot.

  4. deepbevel
    Member
    Posted 10 months ago #

    so you still want the contributor to have default capabilaties, but no access to them? (just to be clear for additional help)

    i'd try css display_none.

  5. deepbevel
    Member
    Posted 10 months ago #

    Do you know how to use a dev tool like Firebug?

  6. blogspotmedia
    Member
    Posted 10 months ago #

    Yes, that could be ok regarding the 2 thing, but on the 1 thing, it is also important that they won't be able to execute it (Quick edit link).
    Regarding firebug, i know some how to use it..

  7. blogspotmedia
    Member
    Posted 10 months ago #

    Just realized if i add on css display none, then i, also, won't be able to see it.

  8. deepbevel
    Member
    Posted 10 months ago #

    if not css, maybe you haven't seen dashboard-commander

  9. deepbevel
    Member
    Posted 10 months ago #

    Also, I haven't done it, but I think it's possible to have conditional css based on user role or id.

  10. blogspotmedia
    Member
    Posted 10 months ago #

    Just had a look on dashboar-comander but still doesn't help, because i don't need to edit the dashboard (wp-admin/) I need to edit: /wp-admin/edit.php.
    Regarding the conditional css on user role or id, that would be great if you can point me to a link.

  11. deepbevel
    Member
    Posted 10 months ago #

    check this out, scroll down to WordPress CSS – body_class()
    maybe you can use

    .author .(but I don't know how to write your user name here!)
    {
    code to be displayed or not goes here
    }

    sorry if this is off track, maybe someone who actually knows will jump in.

    i know you can do this with conditional php, which I've used. But you'd have to wrap each elememnt that will be conditional, not even sure where those elements are located. Would probably be quite a job.

  12. deepbevel
    Member
    Posted 10 months ago #

    hey wait, you said you need to edit /wp-admin/edit.php. so if all the code is there, maybe php conditionals would be practical?

  13. blogspotmedia
    Member
    Posted 10 months ago #

    Thanks for helping me, i check out the body class, but i think that is reffering no to the entire class of author/contributor, but to a specific one, will try only with .author {codehere}. I am not advanced on php and conditional, this require programming skills which i don't have, i know some base code, but no more.

  14. deepbevel
    Member
    Posted 10 months ago #

    this may not be the best we can get but it should work, exepting any syntax probelms..

    <?php
    global $current_user;
    get_currentuserinfo();
    if ($current_user->user_level == 1 );
    ?>
    
    (code here)
    
    <?php }?>
  15. blogspotmedia
    Member
    Posted 10 months ago #

    and where should i add that code? (also what should i type on code here), i don't think it can be added in style.css

  16. deepbevel
    Member
    Posted 10 months ago #

    It's not css, it's php. this code wraps the code you say you need to make conditional, I don't know what that is, you said it was in wp-admin/edit.php. i suspected that all the dashboard elements you want to hide may not be in one file, I'm not sure where that stuff is, but if you find it you can wrap it in that code and get what you need.

  17. deepbevel
    Member
    Posted 10 months ago #

    looks like it may not be possible with css, (which would be better)I've spent some time looking.

    If you find the code you need to be conditional, remember you need to copy everything you do and save it because when you update your theme you'll loose it. Best to use a child theme, which essentially allows you to peserve your edits through updates.

  18. blogspotmedia
    Member
    Posted 10 months ago #

    I have found the code where this info is received by the user, but i cannot add that code you posted, it send an error:
    The code is located in wp-includes/post.php starting from line 114 and tried to do as you said:

    <?php
    global $current_user;
    get_currentuserinfo();
    if ($current_user->user_level == 1 );
    ?>
    register_post_status( 'future', array(
    		'label'       => _x( 'Scheduled', 'post' ),
    		'protected'   => true,
    		'_builtin'    => true, /* internal use only. */
    		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
    	) );
    <?php }?>

    and i get this error:
    Parse error: syntax error, unexpected '<' in /wp-includes/post.php on line 109

  19. deepbevel
    Member
    Posted 10 months ago #

    I don't think this is a theme file, is it? looks like a core function. I wouldn't mess with that.

    If what you need requires editing core files, you'd better reconcider. You'll need to hire someone.

  20. deepbevel
    Member
    Posted 10 months ago #

    Concider a front end post method, makes for an easy way to limit posting options.

    otherwise maybe something here

    Or here

    And finally,looks as though you may be able to combine php with css in your header to get per user admin layout

    something like this, in your header:

    <?php if ( $user_ID ) : ?>
    
    (css for specific user here)
    
    <?php } ?>

    seems it would work with as well user role instead of id. I want to try it myself.

  21. deepbevel
    Member
    Posted 10 months ago #

    if you want to try the code again the way you did, change

    <?php } ?>

    to

    <?php endif ; ?>

    I was mostly trying to illustrate the idea, my on-the-fly coding is bad, didn't do it right.

  22. deepbevel
    Member
    Posted 10 months ago #

    just to further test the idea, I got this to work in my header;

    <?php global $user_level; if ($user_level > 1) { ?>
    
    <style>
    
      #site-title a   {
        display: none;
    }
    </style>
    
    <?php } ?>

    the only thing that's odd, it shows the site title to non-logged in users, but not level 10 users. I expected the opposite, isn't level 10 admin?

    anyway, figure that part out and it appears this is idea will work for your purpose. Just use Firebug to find the admin elements you want to hide, per user level.

  23. blogspotmedia
    Member
    Posted 10 months ago #

    I really appreciate your help, thank you, i wil be testing with that code, currently i added a temporary solution: Wp User Front End
    And one more question, you are saying that the code you created there can be added in the header.php of my theme?
    Regarding the fact that it shows the site title to non-logged in users that is odd, you may have accidently wrap it with the site title.

  24. deepbevel
    Member
    Posted 10 months ago #

    yes, perhaps, but otherwise it's in the head div of my header. Been playing with it all morning. Quite a discovery, never tried to combine php and css in a conditional like this, pretty cool.

    I suppose you could try it as is, just to make sure the idea works for you , and go from there.

  25. blogspotmedia
    Member
    Posted 10 months ago #

    I believe that i found the code:

    <li class="all"><a href="edit.php?post_type=post&all_posts=1">All <span class="count">(160)</span></a> |</li>
    	<li class="publish"><a href="edit.php?post_status=publish&post_type=post">Published <span class="count">(160)</span></a></li>

    but how does class publish and all transform in css?

    .class
    .publish ?

  26. deepbevel
    Member
    Posted 10 months ago #

    i'd go at it like this:

    <?php global $user_level; if ($user_level > 1) { ?>
    
    <style>
    
    #post-body .misc-pub-section {
        display: none;
    }
    
    </style>
    
    <?php } ?>

    I just used firebug to id the element for the publish button in the post editor.

    This is just asn example, I'm not sure exactly what the selector is for the element you are trying to hide, but you can find it with firebug and do like i did above.

  27. blogspotmedia
    Member
    Posted 10 months ago #

    Ok, Thank you, will consider topic resolved.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.