User Role Submit Form
Author | Posts |
---|---|
July 17, 2013 at 4:09 am 6040 | |
Tareq Hasan | Is there any way to lock submitting post to one user role? |
July 17, 2013 at 5:00 am 6045 | |
Tareq Hasan | Yes, possible. If you want to access only [php] /** $current_user = wp_get_current_user(); return isset( $wp_roles->role_names[$role] ) ? translate_user_role( $wp_roles->role_names[$role] ) : false; } function wpuf_block_by_user_role( $form_id ) { if ( get_current_user_role() == ‘Author’ ) { return ‘no’; add_filter( ‘wpuf_can_post’, ‘wpuf_block_by_user_role’ ); |
July 17, 2013 at 8:16 am 6054 | |
Alexis Media | How do i tell it what form i need to what user? I have a few post forms that will need different user roles. |
July 17, 2013 at 4:23 pm 6065 | |
Tareq Hasan | Then you’ve to change the later function like this, hope that gets you started [php] if ( $form_id == ’12’ && $user_role == ‘Author’ ) { } else if ( $form_id == ’13’ && $user_role == ‘Subsriber’ ) { } else if ( $form_id == ’16’ && $user_role == ‘Subsriber’ ) { return ‘no’; |