*

siken

  • ****
  • 138 posts
parameter to refer to the user profile page
« on: May 14, 2022, 01:27:56 AM »
What is the parameter to refer to the user profile as a conditioner?

For home it is <?php if(osc_is_home_page()) { ?>
for search it is <?php if(osc_is_search_page()) { ?>
but I don't know what it is for when the user is in their profile...

<?php if(osc_user_profile_url()) { ?> doesn't work for me

*

mwindey

  • *****
  • 485 posts
Re: parameter to refer to the user profile page
« Reply #1 on: May 14, 2022, 10:19:04 AM »
@Siken

Not sure but maybe this will work...
Code: [Select]
<?php echo osc_user_public_profile_url(osc_item_user_id()); ?>

*

siken

  • ****
  • 138 posts
Re: parameter to refer to the user profile page
« Reply #2 on: May 15, 2022, 03:01:19 PM »
That code does not work, I want to put in footer.php the load of the script that limits the telephone field but only when the user is viewing his profile, so the script will not always load and I do not need to modify the user-profile.php file

*

mwindey

  • *****
  • 485 posts
Re: parameter to refer to the user profile page
« Reply #3 on: May 15, 2022, 05:59:19 PM »
@siken:

here you go  ;)
Code: [Select]
if (osc_is_web_user_logged_in() && ($userId = osc_logged_user_id())) {

*

MB Themes

Re: parameter to refer to the user profile page
« Reply #4 on: May 15, 2022, 09:05:42 PM »
@siken
In some cases, it may be useful to use instead functions:
Code: [Select]
osc_get_osclass_location();
osc_get_osclass_section();
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

siken

  • ****
  • 138 posts
Re: parameter to refer to the user profile page
« Reply #5 on: May 16, 2022, 09:21:05 AM »
@siken:

here you go  ;)
Code: [Select]
if (osc_is_web_user_logged_in() && ($userId = osc_logged_user_id())) {

this code activates the script in all the pages where the user is identified, but I want it to show it only when he accesses his profile in user-profile.php

*

siken

  • ****
  • 138 posts
Re: parameter to refer to the user profile page
« Reply #6 on: May 16, 2022, 09:22:06 AM »
@siken
In some cases, it may be useful to use instead functions:
Code: [Select]
osc_get_osclass_location();
osc_get_osclass_section();

and how do I choose the section of the user's profile?

*

MB Themes

Re: parameter to refer to the user profile page
« Reply #7 on: May 16, 2022, 09:40:52 AM »
@siken

Code: [Select]
if(osc_get_osclass_location() == 'user' && osc_get_osclass_section() == 'profile') { ... }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 485 posts
Re: parameter to refer to the user profile page
« Reply #8 on: May 16, 2022, 12:26:41 PM »
Can someone tell me what is the advantage of loading the script in the footer besides the fact that you don't have to change 3 files every time after an update and only have to update the footer...
Anyway, the script only loads when the user_profile page is opened and that page can only be viewed by the user himself....
I am confused  ??? ???
Code: [Select]
<script>
 $('input[name="sPhone"]').keyup(function(e)                              {
  if (/\D/g.test(this.value))
  {
    // Filter non-digits from input value.
    this.value = this.value.replace(/\D/g, '');
  }
});
</script>

*

siken

  • ****
  • 138 posts
Re: parameter to refer to the user profile page
« Reply #9 on: May 16, 2022, 07:25:43 PM »
Can someone tell me what is the advantage of loading the script in the footer besides the fact that you don't have to change 3 files every time after an update and only have to update the footer...
Anyway, the script only loads when the user_profile page is opened and that page can only be viewed by the user himself....
I am confused  ??? ???
Code: [Select]
<script>
 $('input[name="sPhone"]').keyup(function(e)                              {
  if (/\D/g.test(this.value))
  {
    // Filter non-digits from input value.
    this.value = this.value.replace(/\D/g, '');
  }
});
</script>


If you have a lot of custom scripts, it's always better to leave them all in footer.php instead of adding them to each page individually. In addition to having them controlled, it is easier to update the theme. As long as no one knows which line refers to the user's profile, we'll have to manually add it to user-profile.php so it doesn't waste unnecessary resources on the server by loading so many scripts.