Connections-Business-Directory / Connections

Directory Plugin for WordPress
https://connections-pro.com
GNU General Public License v2.0
27 stars 18 forks source link

Entry Status changed per User Role #323

Open shazahm1 opened 10 years ago

shazahm1 commented 10 years ago

This is more than likely a Link feature. But an interesting idea is to have an option to change the entry status based on user role.

ref: http://connections-pro.com/support/topic/monetization-possibilities/#post-280179

shazahm1 commented 10 years ago

ref:

function cn_user_role( $user_id, $role, $old_roles ) {

    // Check to see if the user is linked to an entry, if not, bail.
    if ( ! $entry_id = get_user_meta( $user_id, 'connections_entry_id', TRUE ) ) return;

    // Change the entry status based on user role.
    switch ( $role ) {

        case 'subscriber':

            cnEntry_Action::visibility( 'unlisted', $entry_id );
            break;

        case 'editor':

            cnEntry_Action::visibility( 'public', $entry_id );
            break;

    }

}

add_action( 'set_user_role', 'cn_user_role', 10, 2 );