Skip Navigation

[Resolved] Show wpv-user attributes in author archive page when users haven't got any post.

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.35 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 18 replies, has 2 voices.

Last updated by Christian Cox 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#575337

First of all, please look at this question.
https://toolset.com/forums/topic/show-wpv-user-attributes-in-author-php-when-users-havent-got-any-post/#post-228064

I would like to realize the same thing without writing PHP.
Even if there is no posting, I would like to post the author 's profile on the author page.
How can I do it?

#575416

There's not currently a way to accomplish this without adding some custom code. The shortcodes provided in the other ticket are designed to allow you to access the user's information even when he or she has not published any posts. Once you copy + paste the PHP into a functions.php file, you can use the shortcodes in your templates.

#575445

Thank you Christian!

I want to use "WordPress Archive".
Can I use this short code in WordPress Archive for authors?

Or should I just use this in author.php?

#575494

Yes, you can use these shortcodes in a WordPress Archive of "Authors", that should be fine.

#575534

Thank you Christian !!!

Since I want to show it concretely, can you issue a private ticket?

I will tell you the URL of the site and login information.

I am in a hurry.
Reply from people other than Christian is okay.

#575753

Private reply is enabled here.

#575778

I wrote like this in functions.php

//SHORTCODE FOR USER ROLE
add_shortcode('get_user_role', 'get_user_role_func');
function get_user_role_func(){
global $wp_query;
$user = $wp_query->get_queried_object();
$arr = array();
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
$arr[] = $role;
}
$res = implode(', ', $arr);
return $res;
}

//SHORTCODE FOR USER DISPLAY NAME
add_shortcode('get_user_display_name', 'get_user_display_name_func');
function get_user_display_name_func(){
global $wp_query;
$current_author = $wp_query->get_queried_object();
$author_display_name='';
if (is_object($current_author)) {
if (isset($current_author->data->display_name)) {
$author_display_name=$current_author->data->display_name;
}
}
return $author_display_name;

}

Where on WordPress Archive should I write this short code?

[wpv-no-items-found]
[wpml-string context="wpv-views"]There are no posts for this user[/wpml-string]
[/wpv-no-items-found]

#575803

Will this work?

[wpv-no-items-found]
[wpml-string context="wpv-views"]There are no posts for this user[/wpml-string]<br />
User role: [get_user_role]<br />
Display name: [get_user_display_name]
[/wpv-no-items-found]

I'm not able to see the login page at wp-admin, I see an error in Japanese:

WordPress管理画面へのアクセスが拒否されました
ただいまエックスサーバーのセキュリティ対策により、
一部のご利用環境からWordPress管理画面へのアクセスが制限されています。

お客様のご利用環境において本画面が表示されてしまう場合は、
サーバーパネル内[WordPressセキュリティ設定]より、制限の解除を行うことが可能です。

解除方法についてご不明な場合は、
本ページのURLまたは、アクセスされたWordPressのURLをお書き添えのうえ、
下記リンクより、エックスサーバーカスタマーサポートまでご連絡をお願いいたします。

エックスサーバーお問い合わせ窓口
サポートマニュアル - WordPressセキュリティ設定
【ご確認ください】
 CloudFlare(クラウドフレア)等、外部サーバーを経由してアクセスされるサービス利用をされている場合、
 お客様(閲覧者)のご利用環境ではなく、経由する外部サーバーが制限に該当している可能性があります。
 この場合も、サーバーパネル内の[WordPressセキュリティ設定]より解除を行ってください。

#575810

I'm sory.
I changed the setting.
You can log in.

#575814

>Will this work?

I tried that, but it seems that information can not be acquired and displayed.
I wrote that short code at the head of "Filter Editor" of "WordPress Archive".

#575862
Screen Shot 2017-10-03 at 3.39.40 PM.png

That's strange, the same code works perfectly for me on a basic site installation. I'm attaching a screenshot. I am curious to see if something else is causing interference. As a test, please temporarily disable all non-Toolset plugins and activate a default theme like Twenty Seventeen. Copy the shortcodes into the Twenty Seventeen theme. If the problem is resolved, then reactivate your plugins and theme one by one until the conflict is revealed. I will be happy to do this test for you if you approve.

#576003

Thank you! I was able to display username.

But,I can't display UserFields I add by Toolset.
Even if there is posting or not, how do I display them?

I would like to know how to create short codes to realize them and where to write in WordPress Archive.

#576067

Okay great! You can find information about displaying User fields here:
https://toolset.com/documentation/user-guides/displaying-wordpress-user-fields/

You can insert these fields using the Fields and Views button above a text editor.

#576243

With this method, User Data will not be displayed if there are no posts.

I am in trouble and I am in a hurry. I am sorry but I would like you to tell me specific examples

#576258

Sorry, I don't have a fast answer for this. As you can see, the other solutions have involved custom code. I can continue to work towards providing some more solutions, but it will take time. This feature is not built in to Toolset.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.