Which variable has the ID of the owner of video?

In page view video, which variable has the ID of the owner of the video / album?

 

Does anyone know how I get the ID of the owner of a video or album? What global variable dolphin has this ID?

 

Thank you!

Quote · 12 Oct 2013

i think this is it:

$this->aFileInfo['medProfId'],
$this->aFileInfo['NickName'],

caredesign.net
Quote · 13 Oct 2013

No such global variable.

Not everything in dolphin can have a global. There is just far to much data to store everything globally.

However there is a local variable that contains it.

On the video view page, and this is very important. It will not be valid on any other page, this contains the owner id of the video currently being viewed. Page URL m/videos/view/NameOfVideo

$this->aFileInfo['medProfId'];

If that is not the page you mean, then be more specific by providing a URL. Being precise is very important in these cases. Computers are not a game of horseshoes or hand grenades where close enough is good enough.




https://www.deanbassett.com
Quote · 13 Oct 2013

Thanks guys!!

 

But $this->aFileInfo['medProfId']; returns an empty value.

 

Yes, the URL is m/videos/view/NameOfVideo

 

But I'm trying to use this variable inside the function _getActionsBox (&$a, $isJustPosted)

 

It governs the comments of the video page.

Quote · 13 Oct 2013

try setting it to a variable - i too have had issues using those types of dolphin coding.

Example:

$Author_ID = $this->aFileInfo['medProfId'];

caredesign.net
Quote · 13 Oct 2013

Yes, I did it. But unfortunately it returns empty value. I tried to put in SESSION and Cookie, and even then it returns empty value when I try to get this variable within this function.

Quote · 13 Oct 2013

what exactly is your code you are trying to use - could you post it? It may be something so small, that you are missing it. I do it myself so many times. After looking at a site for so long, your brain tends to tell your eyes what it should be instead of your eyes telling your brain what is actually there.

caredesign.net
Quote · 13 Oct 2013

The file is BxBaseCmtsView.php

 

This file have a function used to manage existing comments.

 

Watch it:

 

function _getActionsBox(&$a, $isJustPosted)

    {

 

$aAuthor2 = $this->aFileInfo['medProfId'];

 

        $n = $this->getAllowedEditTime();

        $isEditAllowedPermanently = ($a['cmt_author_id'] == $this->_getAuthorId() && $this->isEditAllowed()) || $this->isEditAllowedAll();

        $isRemoveAllowedPermanently = ($a['cmt_author_id'] == $this->_getAuthorId() && $this->isRemoveAllowed()) || $this->isRemoveAllowedAll();

 

        $sRet = '<tr id="cmt-jp-'.$a['cmt_id'].'" class="cmt-foot bx-def-font-small"><td class="' . $this->_sStylePrefix . '-cont-l">&nbsp;'.$aAuthor2.'</td><td class="' . $this->_sStylePrefix . '-cont-m">';

        $sRet .= '<span class="cmt-posted-ago">' . $a['cmt_ago'] . '</span>';

 

        if($this->_aSystem['is_mood'])

            $sRet .= '<span class="bullet">&#183;</span><span class="cmt-mood-text">' . _t($this->_aMoodText[$a['cmt_mood']]) . '</span>';

 

        if($isRemoveAllowedPermanently)

            $sRet .= '<span class="bullet">&#183;</span><a class="cmt-comment-manage-delete" title="' . _t('_Delete') . '" href="javascript:void(0)" onclick="' . $this->_sJsObjName . '.cmtRemove(this, \'' . $a['cmt_id'] . '\'); return false;">'._t('_Delete').'</a>';

 

        if((($isJustPosted && $n) || $isEditAllowedPermanently) && strpos($a['cmt_text'], 'video_comments') === false)

            $sRet .= '<span class="bullet">&#183;</span><a class="cmt-comment-manage-edit" title="'._t('_Edit').'" href="javascript:void(0)" onclick="' . $this->_sJsObjName . '.cmtEdit(this, \'' . $a['cmt_id'] . '\'); return false;">'._t('_Edit').'</a>';

 

        if($a['cmt_replies'])

            $sRet .= '<span class="bullet">&#183;</span>' . $this->_getRepliesBox($a);

 

        if(!$isJustPosted && $this->isPostReplyAllowed())

            $sRet .= '<span class="bullet">&#183;</span>' . $this->_getPostReplyBoxTo($a);

 

        if ($isJustPosted && $n && !$isEditAllowedPermanently)

            $sRet .= '<span class="bullet">&#183;</span>' . _t('_edit_available_for_N_seconds', $n);

 

        $sRet .= '</td><td class="' . $this->_sStylePrefix . '-cont-r">&nbsp;</td></tr>';

        return $sRet;

    }

--------------------------

in bold is what I added to test if I could get the ID correctly.

 

But this function only get the IDs of who is the owner of the comment and who is visiting the page. I want to get the ID of the owner of the video on that page and use this ID within this function.

Quote · 13 Oct 2013

 

Thanks guys!!

 

But $this->aFileInfo['medProfId']; returns an empty value.

 

Yes, the URL is m/videos/view/NameOfVideo

 

But I'm trying to use this variable inside the function _getActionsBox (&$a, $isJustPosted)

 

It governs the comments of the video page.

Well than that's a problem. Because ......

The php file that actually displays the view video page is BxVideosPageView.php

And the function your editing _getActionsBox does not exist anywhere within that file.

I was not kidding when i said it will not work on any other page. And even if its the same page, but the function your editing is not in the file that generates that page then it also may not work.

More information is required. What file are you editing, and what version of dolphin. Both of which will make a difference in determining what to use.

Only file my scans show that function name exists in is BxBaseCmtsView.php and if that is the case, look at the top of that function. Have you tried using the function $this->_getAuthorId() which is used at the top of that function, and looks like it would be what you need to get the author id.


EDIT:  Lol. guess i was right that you were not even in the file that generates the page. Thats why that variable we provided did not work.



https://www.deanbassett.com
Quote · 13 Oct 2013

How about this.

Instead of this.

$aAuthor2 = $this->aFileInfo['medProfId'];



Try this.


$aAuthor2 = $this->_getAuthorId()

https://www.deanbassett.com
Quote · 13 Oct 2013

Actually, scratch that. I am guessing that is the comment author. and not the video author.

There may not be a way to get the video owner id from there.

I will have to study the situation some more, but anything that takes more than 5 minutes, i have to drop. I have to leave things that eat up this much of my time to other people who have more of it.







https://www.deanbassett.com
Quote · 13 Oct 2013

I'm using Dolphin 7.14

BoonEx Video Module.

 

Yes, this function is in a file that is included in the box of comments within this page. I used the feature inspect code of chrome can identify where comments on the video were generated in code and got in this function. It is correct. I have tested the use of 'echo' with common variables and they appeared in the comments.

Quote · 13 Oct 2013

 

Actually, scratch that. I am guessing that is the comment author. and not the video author.

 

Yes, this get o ID of comment author. But thanks. 

I'll keep trying to get this variable from other parts of this page. It appears in other parts of the page, but I can not has assigned it into this function.

 

I'll keep trying. Thank you!

Quote · 13 Oct 2013

Well, I managed to make it work using SESSION. But I do not think very safe to use the ID of another member via SESSION.

 

I will use the Username. But I do not know how to get the username of who is logging. I know just take your ID. Does anyone know how I get the username of the user who is logging and visiting a page? Thanks!

Quote · 13 Oct 2013

The function is getUsername();


But it not what you wanted to do. You original request was to get the author of the video being viewed.

The current logged in member may not necessary be the author of the video, and a guest could also be viewing which would not have a id or a nickname. So your going by the logged in member, it will not work.



https://www.deanbassett.com
Quote · 13 Oct 2013

Thank you! this worked! Laughing

 

I want the owner of the video has the possibility to delete comments of other members in your video.

 

In the current module videos from BoonEx, only the owner of the comment and the admin can delete. That is, if someone to post an offensive comment against the owner of the video, this owner could not delete the comment.

 

Now I gotta link 'delete' appear for the owner of the video too. I clicked and it worked. But I need to do more tests because in two tests received access denied message from javascript, but the other 4 tests, it worked and deleted the comment.

Quote · 13 Oct 2013

I don't get where you are coming from here.  Yes, Boonex did not put it where owners could delete comments left on their content, which is an oversight.  I have requested that this be fixed and Deano put in a ticket but who knows when the ticket will be answered.

You need to get the owner of the content.  My guess was that one needed to add classes for comments to the module; as the blog modules does, to handle the comments.

Geeks, making the world a better place
Quote · 13 Oct 2013

I managed to fix this problem in BoonEx video now. It's working. :)

 

Now the video owner can delete comments from other members on your video's page. :D

Quote · 13 Oct 2013

 

I managed to fix this problem in BoonEx video now. It's working. :)

 

Now the video owner can delete comments from other members on your video's page. :D

Would you like to share your solution?

Geeks, making the world a better place
Quote · 13 Oct 2013

Of course!!! :)

I was here searching for the files I changed, after testing several times. Let's go...

 

1. In file /templates/base/scripts/BxBaseCmtsView.php

1.1 Search for: $n = $this->getAllowedEditTime();

1.2 Just above, add the code:

$aAuthorV = $_SESSION["UserVideo"];

$iVisitorUsername = getUsername();

1.3 Then, three lines below, search for the line that starts with ... $isRemoveAllowedPermanently =

1.4 Change it:

$isRemoveAllowedPermanently = ($a['cmt_author_id'] == $this->_getAuthorId() && $this->isRemoveAllowed()) || $this->isRemoveAllowedAll();

to...

$isRemoveAllowedPermanently = ($a['cmt_author_id'] == $this->_getAuthorId() && $this->isRemoveAllowed()) || $iVisitorUsername==$aAuthorV || $this->isRemoveAllowedAll();

 

2. In file /modules/boonex/videos/classes/BxVideosTemplate.php

2.1 Search for: $aUnit = array(

2.2 Just above, add the code: 

$_SESSION["UserVideo"]=$aInfo['NickName'];

 

Done!!! Is ready!!! I recommend clearing your cache before testing!  And make a backup of the two files before changing them.

Worked with me. Now the author of the video may delete comments for other members on the pages of your videos. :)

Quote · 13 Oct 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.