• Page 1 of 2
  • 1
  • 2
  • »
Forum moderator: bigblog  
uCoz Community » For Webmasters » Custom Solutions » How to put avatar on page with user entries of file catalog
How to put avatar on page with user entries of file catalog
Harina
Posts: 58
Reputation: 0

Message # 1 | 3:58 PM
i want to export users avatar and username to his page showing videos and file. Please help
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 2 | 11:51 PM
Harina, this might be what you're looking for: https://yraaa.ru/scripts....teriala
hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 3 | 5:46 AM
I am using a twitter like inteface and all i wanted is make profile pic and cover photo appear on page of users gallery for example in the pic below is page with user videos and want their user name, avatar and a cover photo they show on that page

http://bendella.com/video/viusr/1/

http://bendella.com/video/viusr/$USER_ID$/



However the pic, username will show are from the personal page even when viewing a gallery of some other person when i use this code

Code
<?if($PAGE_ID$ == 'usr_entry_page')?>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<div id="loadcontent"></div>
<script type="text/javascript">
$('#loadcontent').load('http://bendella.com/index/8 #export');
</script>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<?endif?>


Let me hope you understanding what i mean
Attachments: 3579398.jpg(121.0 Kb)
Post edited by Harina - Sunday, 2019-02-24, 5:52 AM
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 4 | 7:14 PM
Harina, I want to know what the content of your #export div is in the user's personal page template.
hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 5 | 8:31 PM
Code
<div id="export">

<div class="parent">
<div class="image1">
<div class="image1" style="background:url($MYINF_95$) no-repeat center center; background-size:cover; height: 450px; width: 100%;"/></div>
</div>
<div class="image2" style="background:url(<?if($_AVATAR_URL$)?>$_AVATAR_URL$<?else?>http://bendella.com/images/profilepage/no-avatar.jpg<?endif?>) no-repeat center center; background-size:cover; min-height: 150px;">
<div class="image3" style="background:url(<?if($_LOGGED_IN$)?>http://bendella.com/module_assets/users_module/images/online-icon.png<?else?>http://bendella.com/module_assets/users_module/images/offline-icon.png<?endif?>) no-repeat center center; background-size:cover;" style=" min-height: 150px;"></div>
<div class="name-and-username">
<span class="user-name"><?if($_NAME$)?>$_NAME$<?else?>$_USERNAME$<?endif?></span>
<span class="page-username">$_USERNAME$</span>
</div>
</div>



<div style="clear: both;"></div>

<div class="entry-stripe">
<div class="stripe-info">
<div class="strip-info-left">
<?if($_IS_OWN_PROFILE$)?>
<span class="entries"><span class="entry-type">Messages</span><br><span class="entry-number">
<a href="http://bendella.com/index/0-9">$UNREAD_PM$</a>
</span></span>
<?endif?>
<span class="entries"><span class="entry-type">Photos</span><br><span class="entry-number"><a href="<?if($_PHOTO_ENTRIES$)?>$_PHOTO_ACTIVITY_URL$<?else?>javascript://" onclick="new _uWnd('myName','No posts found',500,200,{min:0,shadow:1,header:1,max:0,resize:0},'<b>$_USERNAME$ has not posted yet.</b>');<?endif?>">$_PHOTO_ENTRIES$</a></span></span>
<span class="entries"><span class="entry-type">Videos</span><br><span class="entry-number"><a href="<?if($_VIDEO_ENTRIES$)?>$_VIDEO_ACTIVITY_URL$<?else?>javascript://" onclick="new _uWnd('myName','No posts found',500,200,{min:0,shadow:1,header:1,max:0,resize:0},'<b>$_USERNAME$ has not posted yet.</b>');<?endif?>">$_VIDEO_ENTRIES$</a></span></span>
<span class="entries"><span class="entry-type">Awards</span><br><span class="entry-number"><a href="<?if($AWARDS_READ_URL$)?>$AWARDS_READ_URL$<?else?>javascript://" onclick="new _uWnd('myName','Error',500,200,{min:0,shadow:1,header:1,max:0,resize:0},'<b>You are not allowed to perform this action at the moment.</b>');<?endif?>">$AWARDS$</a></span></span>
<span class="entries"><span class="entry-type">Reviews</span><br><span class="entry-number"><a href="<?if($_REP_READ_URL$)?>$_REP_READ_URL$<?else?>javascript://" onclick="new _uWnd('myName','Action not allowed',500,200,{min:0,shadow:1,header:1,max:0,resize:0},'<b>You are not allowed to perform this action at the moment.</b>');<?endif?>">$_REPUTATION$</a></span></span>
</div>





<div class="strip-info-right">
<span class="strip-info-right-content">

<a class="strip-button-right-for-video" href="/video/viadd"><i class="fa fa-cloud-upload" aria-hidden="true"></i> Upload video</a>

<?if($USER_LOGGED_IN$)?>
<?if($_IS_OWN_PROFILE$)?>
<a class="strip-button-right" href="/index/11"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit this page</a>
<?endif?><?endif?>


<?if($USER_LOGGED_IN$)?>
<?if(!$_IS_OWN_PROFILE$)?>
<?if($GROUP_ID$ == '3' || $GROUP_ID$ == '4')?>
<a class="strip-button-right" href="$_BAN_DO_URL$"><i class="fa fa-ban" aria-hidden="true"></i> Block/Unblock ($_BAN_PERCENT$%)</a>
<?else?>
<a class="strip-button-right" href="<?if($_REP_DO_URL$)?>$_REP_DO_URL$<?else?>javascript://" onclick="new _uWnd('myName','Action not allowed',500,200,{min:0,shadow:1,header:1,max:0,resize:0},'<b>You are not allowed to perform this action at the moment.</b>');<?endif?>"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Write a review</a>
<?endif?>
<?endif?>
<?endif?>

<?if(!$USER_LOGGED_IN$)?>
<a class="strip-button-right" href="$LOGIN_LINK$"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Write a review</a>
<?endif?>

</span>
</div>
</div>
</div>
</div>


There you go
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 6 | 5:36 PM
Harina, oh wait.

Quote Harina ()
load('http://bendella.com/index/8 #export')

/index/8 is your profile. Always. You might want something like this:
Code
<?if($PAGE_ID$ == 'usr_entry_page')?>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<div id="loadcontent"></div>
<script type="text/javascript">
const viusrId = window.location.pathname.split('/').pop();
$('#loadcontent').load(`http://bendella.com/index/8-${viusrId} #export`);
</script>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<?endif?>

Note: I haven't tested this code on a uCoz website. It might or might not work. Let me know either way.

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 7 | 6:32 AM
bigblog, yeah it doesnt work. Works like before, It bring my own avatar and username even when open video gallery of another user
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 8 | 5:32 PM
Harina, just tried it on a test site and it works for me though? what exactly have you done after my message?
hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 9 | 6:03 PM
bigblog,
Quote
what exactly have you done after my message?


i dont know what you mean
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 10 | 6:11 PM
Harina, what are the exact steps that you have performed after I sent you the new code? Like I said, pasting your profile code into my profile page template and my code into the video module template worked for me like a charm. While I assume you've already done this, I still wonder, have you tried accessing other pages?

Make sure you replace your old javascript code with my one for it to work.

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 11 | 4:58 AM
bigblog, yes i replaced mine with yours but still display profile pic and username from /index/8 even when viewing a video entries page of /index/8-20 or /index/8-50
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 12 | 9:16 PM
Harina, the page /video/viusr/20 shows the exact same data as /index/8-20: https://i.sallai.me/8s61bcc18x.png

What browser are you using? (name and version)

My best bet is that you're using an outdated browser that doesn't support ES2015 keywords or template literals (or neither). "/index/8-" will always return the same page as "/index/8", so it's likely that your browser can't append the ID to the fetch url string, in which case this code might work better:

Code
<?if($PAGE_ID$ == 'usr_entry_page')?>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<div id="loadcontent"></div>
<script type="text/javascript">
var viusrId = window.location.pathname.split('/').pop();
// Array.prototype.pop should be supported in pretty much every browser
// unless you're using some ancient artifact of a browser

$('#loadcontent').load('http://bendella.com/index/8-' + viusrId + ' #export`);
// Template literals/string interpolation is not supported in most old browsers
</script>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<?endif?>

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 58
Reputation: 0

Message # 13 | 6:40 AM
bigblog, i got it. There difference is http://bendella.com/video/viusr/20/ and http://bendella.com/video/viusr/20

http://bendella.com/video/viusr/20/ returns data from /index/8 but http://bendella.com/video/viusr/20 will returns data from /index/8-20 so http://bendella.com/video/viusr/20/ is wrong to use. The right one is http://bendella.com/video/viusr/20 but the default $_VIDEO_ACTIVITY_URL$ has a / at the end and that will be the only problem. Actually the new code you sent does not work at all. I reused the first you sent me.

So what about photo gallery, blog and file catalog. Should i use the same?
Soldierdevil
Posts: 144
Reputation: 1

Message # 14 | 7:26 AM
Harina, well just arrived late to the party! I can only manipulate that code shared by Bigblog in the photo albums. Insert this code to page with photo search results.

Code
<?if($PAGE_ID$ == 'udata')?>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<div id="loadcontent"></div>
<script type="text/javascript">
const udataId = window.location.pathname.split('-').pop();
$('#loadcontent').load(`http://bendella.com/index/8-${udataId} #export`);
</script>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<?endif?>


it will show profile pic and cover photo of the user just like the one for the video. The file catalog is another case i can leave to generals. I have no idea how to split since the variable is not at the last.

I hate politics, people who do not make an effort with people and those who try hard to be cool
joexyz
JOE-vascript
Posts: 1737
Reputation: 78

Message # 15 | 6:23 PM
Harina, it doesn't work because of a silly syntax error that I made.

Code
<?if($PAGE_ID$ == 'usr_entry_page')?>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<div id="loadcontent"></div>
<script type="text/javascript">
var pathComponents = window.location.pathname.split('/');
var lastIdx = pathComponents.length - 1;
var viusrId = pathComponents[lastIdx] || pathComponents[lastIdx - 1];
// Array.prototype.pop should be supported in pretty much every browser
// unless you're using some ancient artifact of a browser

$('#loadcontent').load('/index/8-' + viusrId + ' #export');
// Template literals/string interpolation is not supported in most old browsers
</script>
<!--====LOAD THE PROFILE BANNER FROM THE PROFILE PAGE======-->
<?endif?>


here is a version of the code optimized to work with trailing slashes. I could have sworn uCoz treated trailing slashes in a better way... It also uses relative urls so there shouldn't be any issues even if you change your domain name in the future.

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
uCoz Community » For Webmasters » Custom Solutions » How to put avatar on page with user entries of file catalog
  • Page 1 of 2
  • 1
  • 2
  • »
Search: