Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] Subscribe to user don't work if user role is Subscriber

5 Posts
2 Users
1 Reactions
3,673 Views
(@kingstakh)
Active Member
Joined: 8 years ago
Posts: 12
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#2737]

Have some issue, all user have role 'Subscriber' and when try subscribe to user have error:

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at Function.n.parseJSON (jquery.js?ver=1.12.4:4)
at Function.a.parseJSON (jquery-migrate.min.js?ver=1.4.1:2)
at Object.<anonymous> (wpdiscuz.js?ver=5.1.5:1344)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at y (jquery.js?ver=1.12.4:4)
at XMLHttpRequest.c (jquery.js?ver=1.12.4:4)

If user role is Contributor/Author/Editor/Administrator all is ok

c99a4bf3 cea4 4545 9943 0ccc1952c969


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi kingstakh,

Please check does your current active theme contains wp_redirect function? If so, please comment that part and check again. 

I guess this is a similar issue, as described in this post.

https://gvectors.com/forum/how-to-and-troubleshooting/problem-with-user-roles/#post-9302



   
ReplyQuote
(@kingstakh)
Active Member
Joined: 8 years ago
Posts: 12
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

https://gvectors.com/forum/how-to-and-troubleshooting/problem-with-user-roles/#post-9302  link return 404 error



   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I'm sorry, the topic is private. 

Please confirm whether you have found the wp_redirect function in the current active theme?

In that topic, there is a similar issue. In the current active theme, there was the following function:

add_action('admin_init', 'disable_dashboard');

function disable_dashboard() {
   if (current_user_can('subscriber') && is_admin()) {
    $current_user = wp_get_current_user();
       wp_redirect('/author/'.$current_user->user_login.'');
       exit;
   }
}

that was changed to the following one and it started to work correctly.

add_action('admin_init', 'disable_dashboard');

function disable_dashboard() {
   if (current_user_can('subscriber') && (is_admin() && defined('DOING_AJAX') && !DOING_AJAX)) {
    $current_user = wp_get_current_user();
       wp_redirect('/author/'.$current_user->user_login.'');
       exit;
   }
}


   
kingstakh reacted
ReplyQuote
(@kingstakh)
Active Member
Joined: 8 years ago
Posts: 12
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Excellent! I have function with disable dashboard to, now is all ok! Thank you!



   
ReplyQuote
Share:
Scroll to top