How to set privilege to wordpress subscriber for private page

I am having private page.I want to show this page only when “subscriber” logged in.”Editor” should not access this page.How can i set the privilege. 2 Answers 2 Without a plugin something like this should work //functions.php function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } //page template $role = … Read more

If I fork someone else’s private Github repo into my account, is it going to appear in my account as a public repo?

Someone gave me access to one of their private repo on Github. What I want to do is to fork that project into my own account, so I could make use of Github’s pull request feature. I only have a basic account on Github, so I cannot make private repos on my own, but if … Read more

Do subclasses inherit private fields?

This is an interview question. Does subclasses inherit private fields? I answered “No”, because we can’t access them using the “normal OOP way”. But the interviewer thinks that they are inherited, because we can access such fields indirectly or using reflection and they still exist in the object. After I came back, I found the … Read more

Defining private module functions in python

According to http://www.faqs.org/docs/diveintopython/fileinfo_private.html: Like most languages, Python has the concept of private elements: Private functions, which can’t be called from outside their module However, if I define two files: #a.py __num=1 and: #b.py import a print a.__num when i run b.py it prints out 1 without giving any exception. Is diveintopython wrong, or did I … Read more

WordPress i18n-friendly preg_replace post title

I’ve stripped Private: and Protected: from my custom post title that are forced to be private. I’m using CSS Tricks’ snippet for doing so: function the_title_trim($title) { if( is_admin() ) return $title; $title = esc_attr($title); $findthese = array( ‘#Protected:#’, ‘#Private:#’ ); $replacewith = array( ”, // What to replace “Protected:” with ” // What to … Read more