Jump to content

YouTube video on profile


AEGJay

Recommended Posts

  • 3 weeks later...

ooo roleplay's Forums.... XD

Yeah, It's quite simple really...I will be using screenshots from my own community for this (rebornroleplay.com). We have it set where only donators/admins can have videos.

So,

If the person has donated, it will show up for everyone like this;

0dd1fb55f3b2db5f2579e95eb27c86f0.png

You can customise the sizes yourself in the theme editor.

In the Admin cp, Members > Profiles

I've added/created "Youtube link" with the description "Please only the reference, such as: dQw4w9WgXcQ if the link is:  youtube.com/watch?v=dQw4w9WgXcQ"
Obviously, the type is "text".

This is where things can get a little bit tricky depending on what forum groups you have, and how many profile fields you've created. For me, the "Youtube link" is the only one i've created, and therefore is profile field 2 (as about me is 1).

In your theme, click edit code, and make sure you're on the "template" list, not "CSS".

Type Profile in the search box,

This is the file you want to edit;

ac356fb00b204c587ab240c0930c8525.png

Click anywhere in the code on the right, press CTRL + F and find: 

->warn_on

The whole line will look like:

{{if \IPS\Settings::i()->warn_on and !$member->inGroup( explode( ',', \IPS\Settings::i()->warn_protected ) ) and ( \IPS\Member::loggedIn()->modPermission('mod_see_warn') or ( \IPS\Settings::i()->warn_show_own and \IPS\Member::loggedIn()->member_id == $member->member_id ) )}}

above this line, you're going to add your version of this:

{{foreach $sidebarFields as $group => $fields}}
  {{if count( $fields )}}
    <div class='ipsWidget ipsWidget_vertical cProfileSidebarBlock ipsBox ipsSpacer_bottom'>
        {{if $group != 'core_pfieldgroups_0'}}
          <h2 class='ipsWidget_title ipsType_reset'>{lang="$group"}</h2>
        {{endif}}
        <div class='ipsWidget_inner ipsPad'>
        <ul class='ipsDataList ipsDataList_reducedSpacing cProfileFields'>
        {{foreach $fields as $field => $value}}
          {{if $field=="core_pfield_2"}}
            <li class='ipsDataItem'>
              <!--     Medic1                              medic 2                   cop 1                            cop 2                         BANNED                           MEMBER                            VALIDATING -->
              {{if $member->group['g_id'] != 22 && $member->group['g_id'] != 21 && $member->group['g_id'] != 20 && $member->group['g_id'] != 19 && $member->group['g_id'] != 5 && $member->group['g_id'] != 3  && $member->group['g_id'] != 1}}
                <iframe class="ipsDataItem_generic leVideo" height="200" src="https://www.youtube.com/embed/{$value|raw}?autoplay=1" frameborder="0" allowfullscreen></iframe>
              {{else}}
                <span class="ipsDataItem_generic">To see this video, the member needs to donate! Coming soon!</span>
              {{endif}}
            </li>
          {{else}}
            <li class='ipsDataItem'>
              <span class='ipsDataItem_generic ipsDataItem_size3 ipsType_break'><strong>{lang="$field"}</strong></span>
              <span class='ipsDataItem_generic'>{$value|raw}</span>
            </li>
          {{endif}}
        {{endforeach}}
        </ul>
      </div>
    </div>
  {{endif}}
{{endforeach}}

You'll need to update "{{if $field=="core_pfield_2"}}" to whatever profile field is the youtube video.

Then you'll set which forum groups can NOT have a working video in their profile.... this is done by group ID's... You can reverse this to only allow in groups, it depends on how you want it to work. Mine is basically "if the user is NOT in those groups, allow a video."

Just remember != means "does not equal"

Finally, we want to sort the css out for the video itself, this is quite simple...

Save the template, and click on "CSS", and type "Custom" in the search box.

the file you want is custom.css and should be a part of all forum themes,

88802c89c1c97bc67f2a3e668e271ac7.png 82306164083067718805f37ae2fe6e63.png 

 

Above you can see it in my theme and in the default theme.

All you need to do is scroll to the very bottom (depending if you have anything in there)

and add:

.leVideo {
	width: 100%;
  	height: 100%;
}

 

 

I hope this helps!

@AEGJay

Link to comment
7 minutes ago, Elena-Viorica said:

Could someone make a plugin for this, please? And why just YouTube? Why not Vimeo and DailyMotion too?

Well, …

On 10/14/2016 at 10:37 AM, opentype said:

A simple editor field to paste the YouTube URL for automatic embedding works fine. Doesn’t need any plugins. 

Works for Vimeo or anything else IPS embeds by default as well. 

Link to comment
  • 4 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...