vc块中的用户切换插件

时间:2018-09-29 15:27:44

标签: wordpress wordpress-theming

我在wordpress(https://fr.wordpress.org/plugins/user-switching/)中使用了一个名为“用户切换”的插件,该插件可以帮助登录到特定用户。  现在,我想显示将以特定用户身份登录的链接。

$user = new WP_User(23540);
echo $user_switching->maybe_switch_url($user);

在其他地方给我看这个

"xxx.com/wp-login.php? 
action=switch_to_user&user_id=23540&nr=1&_wpnonce=11e02f9391"

但是当我将其放在可视作曲器块中时,会出现此错误

[29-Sep-2018 15:15:40 UTC] PHP Fatal error:  Uncaught Error: Call to a 
member function maybe_switch_url() on null in /home/freelanc/public_html/wp- 
content/themes/freelanceengine/includes/vc_blocks/profiles- 
intercontrats.php:93
Stack trace:
#0 /home/freelanc/public_html/wp- 
content/plugins/js_composer/include/classes/shortcodes/shortcodes.php(570): 
WPBakeryShortCode_fre_block_profile_intercontrat->content(Array, '')
#1 /home/freelanc/public_html/wp- 
content/plugins/js_composer/include/helpers/helpers.php(1311): 
WPBakeryShortCode->output(Array, '')
#2 /home/freelanc/public_html/wp-includes/shortcodes.php(319): 
vc_do_shortcode(Array, '', 'fre_block_profi...')
#3 [internal function]: do_shortcode_tag(Array)
#4 /home/freelanc/public_html/wp-includes/shortcodes.php(197): 
preg_replace_callback('/\\[(\\[?)(fre_bl...', 'do_shortcode_ta...', 
'[fre_block_prof...')
#5 /home/freelanc/public_html/wp-content/themes/freelanceengine/page- 
profile.php(964): do_shortcode('[fre_block_prof...')
#6 /home/freelanc/public_html/wp-includes/template-loader.php(74): 
include('/home/f in /home/freelanc/public_html/wp- 
content/themes/freelanceengine/includes/vc_blocks/profiles-intercontrats.php 
on line 93

谁能解决这个问题,

0 个答案:

没有答案