davidian34
Forum Replies Created
-
Quick fix done!
Hi, so I’m stuck here:
With the query var ?um_user everything works fine now in the english version and in the other languages when I type /user-profile/?um_user=paul or /es/perfil/?um_user=paul or any name.
Basically what I did is adding this code inside the foreach in the get_core_pages() function of the class-config.php file, because it was setting the $permalink[ $page_key ] to the english page key: (I know it’s a fast fix, but I have no time)
if($page_key == ‘user’){
$url = “//{$_SERVER[‘HTTP_HOST’]}{$_SERVER[‘REQUEST_URI’]}”;
$country_slug = explode(‘/’, $url)[3];
if($country_slug == ‘es’){
$permalink[ $page_key ] = 795;
}
elseif($country_slug == ‘fr’){
$permalink[ $page_key ] = 884;
}
}But if I type /es/perfil/paul/, the global $post variable in the function um_is_core_page of the um_short_function file is empty and the page is not found:
function um_is_core_page( $page ) {
global $post;
if ( empty( $post ) ) {
echo(’empty post global variable’);
return false;
}Everything works fine with the english version with any name (/user-profile/paul/).
Why the $post variable is empty with the other languages urls with prettylinks?
Thanks!
- This reply was modified 3 years, 9 months ago by davidian34.
Hi @champsupertramp!
Thanks, I’ve been checking the call stack and I reached the function locate_user_profile() in the file
class-rewrite.php
where I think the stuff is happening.
I’ll let you know where and how I fix it!
Thanks again.
I just need to know where the user-profile url is handled in the profile page with the query var and I then could add the other languages profile urls to do the job.
Knowing where this function is called and passes the $slug would help:
* Get Profile Permalink
*
* @param string $slug
* @return string $profile_url
*/
function profile_permalink( $slug ) {}Thanks!
- This reply was modified 3 years, 9 months ago by davidian34.
Hmmm, I was talking about another language url so yes of course I use a plugin to translate, it’s Polylang. I’ve tried TranslatePress, it does a good job translating and with the urls but sends heavy requests to the database that cause 100% CPU spikes on a little server so I don’t like it.
That’s why i use Polylang but it causes the problems I mentioned in the first post…
This is the Polylang support response:
We had a look at the source code of the Ultimate Member plugin a while ago and noticed that this plugin can't work, out of the box, with Polylang, I'm afraid buying the Pro version won't solve the situation for you. The multilingual compatibility that this plugin developed can work only for WPML as this plugin uses internal functions of WPML (direct calls to methods of the $sitepress object) instead of the the official WPML API. The WPML internal function are unfortunately not handled by Polylang, only the official WPML API are. They are listed here => https://github.com/polylang/polylang/blob/master/modules/wpml/wpml-api.php.
I asked WPML if their plugin would be fully compatible with yours and they told me no.
So I wish you could help with the questions I had in the first place, thanks!
I managed to have it working on windows and android.
However, on IOS I can′t get the user, profile image url and profile url!
They all return empty values!Someone knows how to fix it?
Thanks!
It doesn′t work only like that, you need to have the function um_user() defined!
I copied all the code form github: https://github.com/wp-plugins/ultimate-member/blob/master/core/um-short-functions.php which inludes the um_user() function but
the get_current_user_id(); function inside the code is undefined and I can′t find it anywhere!Hi Chris,
I′m trying to get the dynamically logged-in user with:
um_fetch_user( um_user(‘ID’) ); because get_current_user_id() function in:
um_fetch_user( get_current_user_id() ); was also undefined and I didn′t find it!Thanks!
Forum: Plugins
In reply to: [Download Monitor] Fatal error with ultimate membership proHi! I need help with this error: Fatal error: Uncaught Error: Call to undefined function apply_filters() with the plugin Ultimate Member.
I have copied all the short-functions.php code and I get the error in this line:
return apply_filters(‘um_user_display_name_filter’, $name, um_user(‘ID’), ( $attrs == ‘html’ ) ? 1 : 0 );
inside the function um_user!
I can′t find that function anywhere in the ultimatemember github repository!
Thanks!