AI Assistant
Notifications
Clear all

Update to Ultimate Member Integration Code

2 Posts
2 Users
1 Reactions
2,689 Views
 Who
(@amor)
Member Customer
Joined: 9 years ago
Posts: 20
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
  [#1497]

I had to make a change to the integration code to deal with deleted users so I decided share what I did since I know integration code will not be a priority. If I deleted a user, their comments would show with a blank author. The current integration code has the following line:

if ($comment->user_id) {

but the problem with that is that all comments that were posted by registered users will have a user_id whether or not the user still exists.

I had to change the code to the following for it to work for deleted users:

if (get_userdata($comment->user_id)) {


   
Tom reacted
Quote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4245
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
 

Thank you for sharing this change.



   
ReplyQuote
Share:
Scroll to top