[Solved] How to display usergroup select field in Account ?  

Page 3 / 3

Sylvain Laude
Posts: 11
Customer
(@sylvain-laude)
Member
Joined: 2 weeks ago

Hi,

 

I just bought the custom field plugin. I use it to allow visitors to choose their usergroup when register.

I made like it is written here and that works.

http://prntscr.com/qlfgsd

 

 

But now, I would like that members, once they are registered, are able to change their usergroup.

 

I put the custom field in the account tab as you can see on this screenshot  http://prntscr.com/qlfhwc

but it doen's appear on account as you can see here :  http://prntscr.com/qlfii7

 

The screenshots are made on admin account but it is the same with every usergroup.

 

How to do that please ?

20 Replies
Elvina
Posts: 425
Moderator
(@elvina)
Reputable Member
Joined: 5 months ago

@sylvain-laude,

Please try the following one:

<?php echo implode( ', ', array_diff((array) wpforo_member($userid, 'field_statut'), array(0)) ) ?>

Please note the red mark value is the undesired value(this is not displayed). If there are some other values you don't want to display you just need to add it separated by commas.

Also please don't forget to change the code in both places.

Reply
Sylvain Laude
Posts: 11
Customer
(@sylvain-laude)
Member
Joined: 2 weeks ago

Thank you,

I updated the profile.php file. > that works : http://prntscr.com/qniw30

 

I updated the post.php file in themes/mytheme/wpforo/layouts/2/ > that does not work unfortunately : http://prntscr.com/qnixgx

There is the code of post.php file :

<?php
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;
?>

<div class="wpfl-2">

<div class="wpforo-post-head">
<div class="wpf-left">&nbsp;
<a href="<?php echo esc_url( wpforo_post($topic['last_post'], 'url') ); ?>" class="wpfcl-2"><i class="far fa-caret-square-down wpfsx wpfcl-3"></i> &nbsp; <span class="wpfcl-3"><?php wpforo_phrase('Last Post'); ?></span></a>
<?php do_action( 'wpforo_topic_head_left', $forum, $topic ) ?>
</div>
<div class="wpf-right">
<?php do_action( 'wpforo_topic_head_right', $forum, $topic ) ?>
<?php wpforo_post_buttons( 'icon-text', 'tools', $forum ); ?>&nbsp;
<?php if( wpforo_feature('rss-feed') ): ?><a href="<?php WPF()->feed->rss2_url(); ?>" class="wpfcl-2" title="<?php wpforo_phrase('Topic RSS Feed') ?>"><span class="wpfcl-3"><?php wpforo_phrase('RSS') ?></span> <i class="fas fa-rss wpfsx wpfcl-3"></i></a><?php endif; ?>
</div>
<div class="wpf-clear"></div>
</div>
<?php wpforo_moderation_tools(); ?>

<?php foreach($posts as $key => $post) : ?>

<?php $member = wpforo_member($post); $post_url = wpforo_post($post['postid'],'url'); ?>
<div id="post-<?php echo wpforo_bigintval($post['postid']) ?>" data-postid="<?php echo wpforo_bigintval($post['postid']) ?>" data-userid="<?php echo wpforo_bigintval($member['userid']) ?>" data-mention="<?php echo esc_attr( $member['user_nicename'] ) ?>" data-isowner="<?php echo esc_attr( (int) (bool) wpforo_is_owner($member['userid']) ) ?>" class="post-wrap wpfn-<?php echo ($key+1); ?><?php if( $post['is_first_post'] ) echo ' wpfp-first' ?>">
<?php wpforo_share_toggle($post_url, $post['body']); ?>
<div class="wpforo-post wpfcl-1">
<div class="wpf-left">
<?php if( WPF()->perm->usergroup_can('va') && wpforo_feature('avatars') ): ?>
<div class="author-avatar"><?php echo WPF()->member->avatar($member, 'alt="'.esc_attr($member['display_name']).'"', 110) ?></div>
<?php endif; ?>
<div class="author-data">
<div class="author-name"><span><?php WPF()->member->show_online_indicator($member['userid']) ?></span>&nbsp;<?php wpforo_member_link($member); ?></div>
<?php wpforo_member_nicename($member, '@'); ?>
<div class="wpf-member-profile-buttons">
<?php WPF()->tpl->member_buttons($member) ?>
</div>
<div class="author-title">
<?php wpforo_member_title($member) ?>
</div>

<div class="statut">
<!--HERE CODE PROVIDED BY GVECTORS SUPPORT-->
<?php echo implode( ', ', array_diff((array) wpforo_member($userid, 'field_statut'), array(0)) ) ?>
<!--END-->
</div>
<?php wpforo_member_badge($member) ?>
</div>
<div class="wpf-clear"></div>
</div><!-- left -->
<div class="wpf-right">
<div class="wpforo-post-content-top">
<div class="wpf-post-actions">
<?php if( $post['is_first_post'] ){
$buttons = array( 'solved', 'sticky', 'private', 'close', 'report', 'delete' );
}else{
$buttons = array( 'report', 'delete' );
}
wpforo_post_buttons( 'icon-text', $buttons, $forum, $topic, $post );
?>
</div>
<a href="<?php echo esc_url( $post_url ); ?>" class="wpf-post-link"><i class="fas fa-link wpfsx"></i></a>
<?php wpforo_share_toggle($post_url, $post['body'], 'top'); ?>
</div>
<div class="wpforo-post-content">
<?php wpforo_content($post); ?>
<?php wpforo_post_edited($post); ?>
<?php do_action( 'wpforo_tpl_post_loop_after_content', $post, $member ) ?>
<?php if( wpforo_feature('signature') ): ?>
<?php if($member['signature']): ?><div class="wpforo-post-signature"><?php wpforo_signature( $member ) ?></div><?php endif; ?>
<?php endif; ?>
<div class="wpf-post-button-actions">
<?php
$buttons = array( 'reply', 'quote', 'approved', 'edit', 'like' );
wpforo_post_buttons( 'icon-text', $buttons, $forum, $topic, $post );
?>
<?php if($post['status']): ?>
<span class="wpf-mod-message"><i class="fas fa-exclamation-circle" aria-hidden="true"></i> <?php wpforo_phrase('Awaiting moderation') ?></span>
<?php endif; ?>
</div>
</div>
<div class="wpforo-post-content-bottom">
<div class="cbleft wpfcl-0"><?php wpforo_phrase('Posted') ?> : <?php wpforo_date($post['created'], 'd/m/Y g:i a') ?>
<?php wpforo_post_likers($post['postid']); ?>
</div>
<div class="wpf-clear"></div>
</div>
</div><!-- right -->
<div class="wpf-clear"></div>
</div><!-- wpforo-post -->
</div><!-- post-wrap -->

<?php if( $post['is_first_post'] ): ?>
<div class="wpforo-topic-meta">
<?php wpforo_tags( $topic ); ?>
</div>
<?php endif; ?>

<?php do_action( 'wpforo_loop_hook', $key ) ?>

<?php endforeach; ?>
</div><!-- wpfl-2 -->

Cheers.

 

Reply
1 Reply
Razmik
Admin
(@razmik)
Joined: 5 years ago

Member
Posts: 9

Hi Dear @sylvain-laude

You should replace your added code.

FROM: 
<?php echo implode( ', ', array_diff((array) wpforo_member($userid, 'field_statut'), array(0)) ) ?>

TO: <?php echo implode( ', ', array_diff((array) wpforo_member($member, 'field_statut'), array(0)) ) ?>
Reply
Elvina
Posts: 425
Moderator
(@elvina)
Reputable Member
Joined: 5 months ago
Posted by: @sylvain-laude

I updated the post.php file in themes/mytheme/wpforo/layouts/2/ > that does not work unfortunately : http://prntscr.com/qnixgx

As Astghik already mentioned you should customize the topic.php file located in the /wpforo/wpf-themes/classic/layouts/2 folder. Please try to add the code here and check again.

Reply
Sylvain Laude
Posts: 11
Customer
(@sylvain-laude)
Member
Joined: 2 weeks ago

Hi @elvina,

 

Sorry for misunderstanding.

 

I added the code on topic (I tagged your code to see where it should be displayed) :

http://prntscr.com/qnx15j > The value is not displayed but the tag is displayed.

 

But I need the value on post.php but it doens't appears either (I tagged the code to see where it should be displayed):

http://prntscr.com/qnx3e7 > value not displayed but tag is displayed (so I guess the file is the good one and located in the good folder, doesn't it ?)

 

Best regards.

Reply
Sylvain Laude
Posts: 11
Customer
(@sylvain-laude)
Member
Joined: 2 weeks ago

Hey @elvina & @razmik,

Thank you guys for your patience and help ! You are great support !

Everything seems working as wanted Smile

Please let me know where I can let a review. That plugin rocks Smile

Cheers.

Reply
2 Replies
Tom
 Tom
Admin
(@tomson)
Joined: 5 years ago

Support Team
Posts: 3021

Thank you @sylvain-laude,

We'd really appreciate if you could leave a good review in the plugin review section here: https://wordpress.org/support/plugin/wpforo/reviews/

 

Reply
Sylvain Laude
Customer
(@sylvain-laude)
Joined: 2 weeks ago

Member
Posts: 11

Hi @tomson, done !

 

Reply
Page 3 / 3
Share:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: