Getting a role based on a localized role name

Just guessing, but maybe: $admin = get_role( __( ‘administrator’ ) ); If you’re trying to make sure that WP translates the string for a specific locale, __() will return the translated string. So if get_role(‘administrator’) works and on a French setup get_role(‘administrateur’) would work, then the above code snippet should do what you need.

if user has a certain role then display image

In your template: // rolename could for e.g. be ‘editor’ or ‘author’ or ‘administrator’ author_can( get_the_ID(), ‘rolename’ ) AND print “<img src=”https://wordpress.stackexchange.com/questions/56658/…” alt=”A kool badge!” />”;

How do I display user name, role and site name using HTML tags inside a dashboard notification?

You can use the bloginfo( ‘name’ ) function to display the site name. Information about the current logged in user can be retrieved using the get_currentuserinfo() function. Here is the fixed code: function my_network_notice(){ global $pagenow, $currentuser; get_currentuserinfo(); if ( $pagenow == ‘index.php’) : ?> <div id=”secondaryBox”> <div id=”author”> <img src=”https://wordpress.stackexchange.com/questions/77448/<?php echo get_stylesheet_directory_uri(); ?>/img/btn-articles-admin.png” width=”40px” … Read more

Allow editors to post iframes [duplicate]

try the iframe shortcode plugin http://wordpress.org/extend/plugins/iframe/ Embed iframe using shortcode [iframe src=”http://player.vimeo.com/video/819138″ width=”100%” height=”480″] ps: you can also use the default oembed shortcode: it supports YouTube, Vimeo, DailyMotion, Flickr, Twitter, … and more. Example: Screenshot: See more here: http://codex.wordpress.org/Embeds

Display User Role Next To Comment

Just pass the user id to this function: function get_role($user_id) { if(is_int($user_id)) { $user = new WP_User( $user_id ); if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo $role; } } else echo “Something else”; }

Membership subscription, change user role when subscription runs out

Presumably you’ve saved an expiration data somewhere, so setup a wp_cron job to run daily. That job should check the expiration dates, and change the roles for users whose dates are past. if ( ! wp_next_scheduled( ‘alter_user_role_hook’ ) ) { wp_schedule_event( strtotime(‘tomorrow’), ‘daily’, ‘alter_user_role_hook’ ); } function alter_user_role_function() { global $wpdb; $today = date(‘Y-m-d H:i:s’,strtotime(‘today’)); … Read more

Change post status based on user role

I’m then trying to figure out how to change the post status once their subscription is up function downgrade_user_role( $entry, $subscription_id, $transaction_id, $new_payment_amount ) { $user = GFUserData::get_user_by_entry_id( $entry[‘id’] ); $user->set_role( ‘subscriber’ ); global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE $wpdb->posts SET post_status=”draft” WHERE post_author = %d AND post_status IN (‘publish’, ‘future’)”, $user->ID ) ); } add_action( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)