Osclass Support Forums
Osclass theme support => Beta Osclass Theme => Topic started by: Vettalo on September 22, 2021, 12:58:58 PM
-
Hello guys,
how can i get the public profile url by user name not id
www.example.com/user/alex
i have url by id number
www.example.com/user/93
in demo i can see that when you click view user profile it shows url by name
Regards.
-
asking a question and answering it lol,
to get public profile by s_name simply go to includes/osclass/helpers/hUser.php
and look for:
function osc_user_public_profile_url($id = null) {
if($id==null) {
$id = osc_user_id();
}
if ($id != '') {
if ( osc_rewrite_enabled() ) {
$user = User::newInstance()->findByPrimaryKey($id);
$path = osc_base_url().osc_get_preference('rewrite_user_profile')."/".$user['s_username'];
} else {
$path = sprintf(osc_base_url(true) . '?page=user&action=pub_profile&id=%d', $id);
}
} else {
$path = '';
}
return $path;
}
and replace s_username with s_name and your done.
code will look like
function osc_user_public_profile_url($id = null) {
if($id==null) {
$id = osc_user_id();
}
if ($id != '') {
if ( osc_rewrite_enabled() ) {
$user = User::newInstance()->findByPrimaryKey($id);
$path = osc_base_url().osc_get_preference('rewrite_user_profile')."/".$user['s_name'];
} else {
$path = sprintf(osc_base_url(true) . '?page=user&action=pub_profile&id=%d', $id);
}
} else {
$path = '';
}
return $path;
}
Regards.
-
asking a question and answering it lol,
to get public profile by s_name simply go to includes/osclass/helpers/hUser.php
and look for:
function osc_user_public_profile_url($id = null) {
if($id==null) {
$id = osc_user_id();
}
if ($id != '') {
if ( osc_rewrite_enabled() ) {
$user = User::newInstance()->findByPrimaryKey($id);
$path = osc_base_url().osc_get_preference('rewrite_user_profile')."/".$user['s_username'];
} else {
$path = sprintf(osc_base_url(true) . '?page=user&action=pub_profile&id=%d', $id);
}
} else {
$path = '';
}
return $path;
}
and replace s_username with s_name and your done.
code will look like
function osc_user_public_profile_url($id = null) {
if($id==null) {
$id = osc_user_id();
}
if ($id != '') {
if ( osc_rewrite_enabled() ) {
$user = User::newInstance()->findByPrimaryKey($id);
$path = osc_base_url().osc_get_preference('rewrite_user_profile')."/".$user['s_name'];
} else {
$path = sprintf(osc_base_url(true) . '?page=user&action=pub_profile&id=%d', $id);
}
} else {
$path = '';
}
return $path;
}
Regards.
it gives error not found
i will look after it later.
Regards.
-
User ID is default value for "user name" field, so it actually does not use user ID, but user name.
Having different value in user name could do the trick!
-
User ID is default value for "user name" field, so it actually does not use user ID, but user name.
Having different value in user name could do the trick!
its not hard to get it but i have changed my mind.
i will give advantage to users to choose username in their profile, this way will have to pick his name or his company name.
thats better than changing userid with their names.
i already done it by adding this code in user profile.
<div class="row">
<label for="s_username"><?php _e('User name', 'beta'); ?></label>
<div class="input-box"><?php UserForm::username_text($user); ?> <div id="available"></div></div>
</div>
Regards.
-
@Vettalo
Just verify if it is checking user name uniqueness as well ;)
-
@Vettalo
Just verify if it is checking user name uniqueness as well ;)
What do u mean?
This code is not working?
<div class="row">
<label for="s_username"><?php _e('User name', 'beta'); ?></label>
<div class="input-box"><?php UserForm::username_text($user); ?> <div id="available"></div></div>
</div>
-
It is working perfectly but not inside the profile form
It has unique form as action username update.
One question!
Does beta theme has pagination in public profile i cant see it?
Regards.
-
@Vettalo
I do not thin Beta theme has pagination there, as osclass did not support it here (until you brought completely custom code & solution there)
-
@Vettalo
I do not thin Beta theme has pagination there, as osclass did not support it here (until you brought completely custom code & solution there)
Yes you are right osclass missing many functions i see you added photo profile in your osclass version updates and that fumction was very important, to be honest you have made good job i have checked all the functions you added in it and all them are effective and was missed before except the tinymce i see this function should be disabled for users i suppose all at least should be enabled only for sellers (company).
Best regards.
-
@Vettalo
Thank you, you can disable TinyMCE in Oc-admin > Listings > Settings.