-
HI,
I have a situation. I want to give different profile view for two different users. So i created another templates/view.php -> templates/view2.php. But if i use this in short code, the template is not appearing in the page. Do i need to add some other things to achieve this.
Please advice.Thanks
You need to add the template to shortcode-main.php file in functions
for example, this is the view.php template behaviour
PHP1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950case 'view':if (isset($args['user'])){if ($args['user'] == 'author') {if (is_author()){$user_id = get_query_var('author');} else {$user_id = get_the_author_meta('ID');}} else {$user_id = userpro_get_view_user( $args['user'], 'shortcode_user' );}} else {$user_id = userpro_get_view_user( get_query_var('up_username') );}if ($user_id == 'not_found' || $user_id == 'not_authorized') {if (locate_template('userpro/' . $user_id . '.php') != '') {include get_template_directory() . '/userpro/'. $user_id . '.php';} else {include userpro_path . "templates/$user_id.php";}} elseif ($user_id == 'login_to_view'){/* attempt to view profile so force redirect to same page */$args['force_redirect_uri'] = 1;$template = 'login';$args['template'] = 'login';if (locate_template('userpro/' . $template . '.php') != '') {include get_template_directory() . '/userpro/'. $template . '.php';} else {include userpro_path . "templates/login.php";}} elseif ($user_id == 'login_to_view_others'){/* attempt to view profile so force redirect to same page */$args['force_redirect_uri'] = 1;$template = 'login';$args['template'] = 'login';if (locate_template('userpro/' . $template . '.php') != '') {include get_template_directory() . '/userpro/'. $template . '.php';} else {include userpro_path . "templates/login.php";}} elseif (userpro_fields_group_by_template( $template, $args["{$template}_group"] ) != array('') ){if (locate_template('userpro/' . $template . '.php') != '') {include get_template_directory() . '/userpro/'. $template . '.php';} else {include userpro_path . "templates/$template.php";}}break;Now you need to add custom templates using the same logic, you can add any number of templates and use userpro template=XXXXX to load them. 🙂
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.