*

Vink

  • *****
  • 329
    • NedDate.nl
MOD: in the Spotlight
« on: January 11, 2015, 04:34:46 PM »
Hi!

I noticed that not many osdate sites make use of the featured profiles, so i write a mod that make use of the FEATURED_PROFILES_TABLE
 (so you don't have to alter or add a database table).
Here is how it works:
A user can put him/herself for some time ( set by the Admin, i recomment 3 or 4 weeks) in the Spotlight..with is in a prominent place on your site. see picture..



After the Spotlight time is past that user is removed out of the spotlight automatically.
Users without a Profilepicture can not add themselves to the spotlight.
When a user removes his profilepicture when he is in the spotlight... that user is removed automatically.

After testing its working great and is allready in use on my site.. so I want to share it..
There is one thing i want to ask to solve here before release this Mod here.
 
To limit the number of members shown on the homepage i have:
Code: [Select]
$allspot = $osDB->getAll('select fet.userid, fet.start_date, fet.end_date, usr.username
  from ! as fet, ! as usr where fet.userid = usr.id order by end_date DESC LIMIT 7', array( FEATURED_PROFILES_TABLE, USER_TABLE) );

so if there are 10 members who put themselves in teh spotlight.. only 7 are shown.
Now the tricky part....
I want to delete this non visible 3 members from the FEATURED_PROFILES_TABLE so they can put themselves again in the spotlight as number 1.
I can not get the query for that...

I do have a hard coded query that works:
Code: [Select]
$osDB->query('delete from ! where userid  not in (95, 200)', array(FEATURED_PROFILES_TABLE) );
the members with userid 95 and 200 are staying in the datbase and all others are removed.
So.. i need a array  like (95, 200, 334, 400, 535) with userid of the 7 users from $allspot.

Can anyone help to to achieve this?

Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: MOD: in the Spotlight
« Reply #1 on: January 11, 2015, 09:53:23 PM »
Hi Vink,

Thanks for sharing the cool Mod.

Shouldn't DESC LIMIT 7 be set to DESC LIMIT 10 ?

If not hopefully someone that knows database code can help.
« Last Edit: January 11, 2015, 10:05:26 PM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Vink

  • *****
  • 329
    • NedDate.nl
Re: MOD: in the Spotlight
« Reply #2 on: January 12, 2015, 08:08:03 AM »
Hi Phill,

If i do that the last 10 members are selected.. on my homepage I do:
{foreach item="item" key=key from=$allspot}
that only shows the 7 last Spotlight members..no need to be more because
i want to show only 7.
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

Vink

  • *****
  • 329
    • NedDate.nl
Re: MOD: in the Spotlight
« Reply #3 on: January 15, 2015, 01:17:31 PM »
Hi
The Mod is ready, if there is any interest in it you can post it here.
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: MOD: in the Spotlight
« Reply #4 on: January 15, 2015, 08:40:06 PM »
Hi
The Mod is ready, if there is any interest in it you can post it here.

Hi Vink,

That's great news to hear :) Yes please, Can you post it here thanks?
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Vink

  • *****
  • 329
    • NedDate.nl
Re: MOD: in the Spotlight
« Reply #5 on: January 16, 2015, 06:49:16 PM »
Hi
Here is the Mod: in the Spotlight... tested on 2.19a to 2.6.5
You can only apply this mod to your site if you don't use the Featured_profiels! because this Mod make use of the FEATURED_PROFILES_TABLE in the database.

step1)
You need to turn off in your Admin the normal featured profile feature.
admin => site information => Number of featured profiles to be displayed on home page >>> 0
admin => mailsettings => Send email when a profile is added to featured profile list? >>> no

step2)
Find in index.php
Code: [Select]
$t->assign('rendered_page', $t->fetch('page.tpl') );
}
}

and add after that
Code: [Select]
  ## MOD in the Spotlight =>made by Vink: Moderator http://www.osdateforum.com
  ## see: http://www.osdateforum.com/addons-modules-7/mod-in-the-spotlight/
 
 
 //Delete from SpotlightList if end_date has past. End_date is set in spotlight.php on line 37
  $osDB->query('delete from ! where end_date < ?', array(FEATURED_PROFILES_TABLE, time()) );
 
  //Has the User a Profilepicture?
  $piccount = $osDB->getOne('select count(*) from ! where userid = ?', array(USER_SNAP_TABLE, $_SESSION['UserId']) );

  //Delete from SpotlightList if User removed Picture after submit to List / prevent default nopicture in the Spotlight.
  if ($piccount < 1){
  $osDB->query('delete from ! where  userid = ?', array(FEATURED_PROFILES_TABLE, $_SESSION['UserId']) );
  }

  //get all the Users from FEATURED_PROFILES_TABLE and get names from user_table
  $allspot = $osDB->getAll('select fet.userid, fet.start_date, fet.end_date, usr.username
  from ! as fet, ! as usr where fet.userid = usr.id order by end_date DESC LIMIT 7', array( FEATURED_PROFILES_TABLE, USER_TABLE) );


  //if there are 7 on the Spotlightlist -> remove non visible ( > 7) from FEATURED_PROFILES_TABLE so the user can put hem/herself again in list.
  $outspot = $osDB->getAll('select end_date from ! order by end_date DESC LIMIT 7,1', array( FEATURED_PROFILES_TABLE) );

  foreach ($outspot as $msg) {
$allsp[] = $msg['end_date'];
}

  $osDB->query('delete from ! where end_date = ?', array(FEATURED_PROFILES_TABLE, $allsp ));

  $t->assign('allspot', $allspot );

  // end Mod in the Spotlight

step3)
Find in homepage.tpl (this could be different for with OsDate version you have.. its the place where the Spotlight appears )
Code: [Select]
{include file='user_home_stats.tpl'}<br />and add after that:
Code: [Select]
{include file="spotlighthome.tpl"}<br />
step4)
find in your admin => featured_profile.tpl
Code: [Select]
<input type="text" name="req_exposures" value="{ if $data.req_exposures > 0}{$data.req_exposures}{else}999999{/if}" />and make it
Code: [Select]
<input type="text" name="req_exposures" value="{ if $data.req_exposures > 0}{$data.req_exposures}{else}0{/if}" />
step5)
Make the $start_date and end_date  in your admin=>featured_profile.php like so.
(do not forget to add the $uur and $minu)

Code: [Select]
$uur = date("H").'hours';
$minu = date("i").'minutes';

$start_date = strtotime($_POST['startYear'].'-'.$_POST['startMonth'].'-'.$_POST['startDay'].' '.$uur.' '.$minu);

$end_date = strtotime($_POST['endYear'].'-'.$_POST['endMonth'].'-'.$_POST['endDay'].' '.$uur.' '.$minu);

step6)
download the spotlight.php , spotlight.tpl , spotlighthome.tpl as spotlight.rar from here and unrar it.

step7)
nearly there :D
upload all your files to the right template dir. and admin dir on your site.

step8)
Take a cup of coffee and enjoy your new in the Spotlight Mod!  :D

« Last Edit: January 18, 2015, 04:08:05 PM by Vink »
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: MOD: in the Spotlight
« Reply #6 on: January 16, 2015, 07:30:54 PM »
Hi Vink,

Thank you for sharing your nice Mod :)
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

heebeha

  • **
  • 60
  • Me
Re: MOD: in the Spotlight
« Reply #7 on: March 18, 2015, 03:16:45 PM »
Thank you for sharing.   Very kind of you

Got a demo site so we cam see it in action?

Re: MOD: in the Spotlight
« Reply #8 on: March 18, 2015, 10:54:17 PM »
Hi.

It it's possible, that I did something badly but for me this the mod is out of order.

Re: MOD: in the Spotlight
« Reply #9 on: March 20, 2015, 07:36:41 PM »
this looks like a great mod, does it work with the responsive version of osdate? thanks,

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: MOD: in the Spotlight
« Reply #10 on: March 20, 2015, 10:10:15 PM »
this looks like a great mod, does it work with the responsive version of osdate? thanks,

Hi mnarkyp77,

I would say it could be,  but you would have to mod the tpl files sizing to make it also responsive though.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35