forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Αndré on March 30, 2012, 02:27:40 pm

Title: Hot pictures plugin for cpg1.5.x
Post by: Αndré on March 30, 2012, 02:27:40 pm
Set pictures as 'hot' for x days and display them in a meta album 'hotpics'.

This plugin is the result of a freelance request by altenae (http://forum.coppermine-gallery.net/index.php?action=profile;u=12710). Just install the plugin as described in the Coppermine docs. By default it will add 3 buttons to the intermediate page view for the administrator. In codebase.php you can change those buttons
Code: [Select]
$buttons = array(1, 2, 3); // each number will create a button 'Hot for x days'and also determine, which user groups will see the buttons
Code: [Select]
$groups = array(1); // enter the group IDs which should be allowed to set pictures as 'hot'(there's no web configuration interface available).
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Deus on September 14, 2012, 09:55:20 pm
what is a meta album?
How do I set one up?

Title: Re: Hot pictures plugin for cpg1.5.x
Post by: lurkalot on September 14, 2012, 10:19:31 pm
what is a meta album?
How do I set one up?

This plugin creates a extra album =  'hotpics'  which you can get to display by adding it to the breadcrumbs list.

Config > Album list view > scroll down to, "The content of the main page"  and add it to the breadcrumb list, example,

breadcrumb/slider/catlist/alblist/hotpics/toprateda/random,2/lastup,2/onlinestats  etc.

You can also add more meta albums by using the More meta albums plugin, http://forum.coppermine-gallery.net/index.php/topic,63706.0.html
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Deus on September 14, 2012, 10:38:07 pm
Brilliant, thanks Lurkalot, that had me scratching my head a bit.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 25, 2013, 03:28:04 pm
Critical error
There was an error while processing a database query

I disabled the plugin and tryed to enabled it back but I get this error.

I proabibly did not removed the hot pictures before disabling it.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Phill Luckhurst on September 25, 2013, 03:50:01 pm
To know what the problem is you need to detail the full error message. This can be done by enabling debug.

You can disable the plugin via phpmyadmin, you can also enable debug there. Details of how to do this can be found in the docs and in numerous threads in the forums.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 25, 2013, 04:01:26 pm
Critical error

There was an error while processing a database query.
While executing query 'ALTER IGNORE TABLE cpg_pictures ADD hot_expire int(11) default '0'' in plugins/hot_pictures/codebase.php on line 180

mySQL error: Duplicate column name 'hot_expire'

File: /home/allvip/public_html/allvip.us/gallery/include/functions.inc.php - Line: 272
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 25, 2013, 04:17:29 pm
I can not disable the plugin via phpmyadmin because is not in the  cpg_plugins table and his does not have his own table like cpg_plugin_xfeeds
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 25, 2013, 04:19:22 pm
I would like to remove all the database of this plugin and do a fresf install of hot pictures plgin but can not find it in phpMyAdmin
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on September 26, 2013, 12:38:33 pm
Hello allvip,

I have the same problem as you, then:

1º.- within the structure of the table "cpg_pictures" manually delete the column "hot_expire".

2º.- edit codebabe.php

find:
Code: [Select]
// Add new column
$thisplugin->add_action('plugin_install', 'hot_pictures_install');
function hot_pictures_install() {
    global $CONFIG;
    cpg_db_query("ALTER IGNORE TABLE {$CONFIG['TABLE_PICTURES']} ADD hot_expire int(11) default '0'");
    return true;
}

and replace:
Code: [Select]
// Add new column
$thisplugin->add_action('plugin_install', 'hot_pictures_install');
function hot_pictures_install() {
    global $CONFIG;
    cpg_db_query("ALTER TABLE {$CONFIG['TABLE_PICTURES']} ADD hot_expire int(11) default '0'");
    return true;
}

// Remove new column
$thisplugin->add_action('plugin_uninstall', 'hot_pictures_uninstall');
function hot_pictures_uninstall() {
    global $CONFIG;
    cpg_db_query("ALTER TABLE {$CONFIG['TABLE_PICTURES']} DROP hot_expire");
    return true;
}

Regards.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 26, 2013, 01:51:07 pm
I already deleted hot expire.
thanks for the code.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: allvip on September 26, 2013, 02:44:38 pm
to delete a colum from a table with phpMyAdmin:

click the coppermine database - left sidebar of phpMyAdmin
click table cpg15x_pictures
click SQL button at top of the page
click Clear
paste in the box :

ALTER TABLE cpg15x_pictures
DROP COLUMN hot_expire

Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on September 27, 2013, 08:51:09 pm
Seems that
Quote
ALTER IGNORE ...
doesn't work as expected. Which MySQL version is installed on your server?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on September 27, 2013, 10:57:25 pm
Hello André,

Quote
version 5.1.68

Regards.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 01, 2013, 04:20:17 pm
Confirmed on my testbed. Seems that I misunderstood IGNORE in this context. Will release a new plugin version soon.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 04, 2013, 11:51:10 am
Plugin version 1.5 attached to initial post.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 24, 2013, 05:03:36 am
Quote from: Andre
By default it will add 3 buttons to the intermediate page view for the administrator.

There don't seem to be any new buttons in intermediate page.  I put it in the breadcrumb, and the empty block shows up everywhere.  But I don't see any new buttons, anywhere.

Should I go into the codebase.php file and edit something?  If so, please tell me what.  Otherwise ???

My gallery:  http://inkscapecommunity.com/ic_gallery/index.php

Thanks for your help   :)
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 27, 2013, 04:59:19 am
Unistalled for now.  Let me know if you want me to help troubleshoot and I will re-install it.   :)
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 29, 2013, 04:15:35 pm
Please test if it works with the curve theme: http://inkscapecommunity.com/ic_gallery/index.php?theme=curve
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 31, 2013, 07:59:42 am
Ok, I re-installed it, but still don't see the new buttons, not even in Curve theme.  Let me put it in the breadcrumbs....  Hhm, still no new buttons.  I have several themes available.  Should I check them all?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 31, 2013, 08:03:02 am
update - no new buttons in any theme
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 31, 2013, 10:29:44 am
I just installed a new gallery and the plugin and it worked as expected, see attached screenshot. Have you tested it as admin?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 31, 2013, 12:35:48 pm
Yes, I've only tested as admin.  It's nice to see where the buttons are supposed to be, but they still aren't showing up in my gallery.  (Attachement to show.)  I wonder if some other plug-in that I've installed could be somehow affecting it?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 31, 2013, 12:37:52 pm
I wonder if some other plug-in that I've installed could be somehow affecting it?
Please try to disable one by one to answer that question yourself.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 31, 2013, 12:43:34 pm
Other plug-ins:

Filetypes Editor v2.1
Favorites Button v1.2
SVG Support v0.1
Remote Videos v1.8
Big Pop Ups v1.0
Flash Media Player v2.1
Hot Pictures v1.5

Ok, I will try disabling 1 by 1.  But I can't do it right now.  I'll be able to work on that tomorrow.  I'll post results.

Thanks
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on October 31, 2013, 12:46:43 pm
Is there any particular procedure I should follow?  Should I uninstall all of them, and then re-install 1 at a time?  Or start with all installed, and uninstall 1 at a time?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on October 31, 2013, 01:14:31 pm
It's probably easier to uninstall all of them, then install just the hot pictures plugin and check if it works as expected.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: mitko on November 01, 2013, 02:26:02 pm
Question regarding this plugin:
1. Is it possible to hide it in category view (keep only on main)?
2. Is it possible to hide automatically "hot" sections if no any hot pics selected? Dont like empty space like here: http://www.lightphotos.net/photos/index.php?cat=12
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 01, 2013, 02:36:20 pm
If we just display it in the root category, your second question is obsolete, right?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on November 01, 2013, 06:56:34 pm
I'm just about to get started uninstalling plug-ins.  But I wanted to say that I like mitko's idea too  :)
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on November 01, 2013, 07:07:59 pm
Ok, all plug-ins uninstalled.  I even uninstalled and reinstalled Hot Pics.  But unfortunately, still no new buttons, even using Curve theme.  Awaiting further instructions  :)

Since I don't know how long it will take, I will go ahead an re-install all my plug-ins, so the gallery will function in the meanwhile.

Thanks again for your help!
Title: Re: Re: Hot pictures plugin for cpg1.5.x
Post by: mitko on November 02, 2013, 09:02:05 pm
If we just display it in the root category, your second question is obsolete, right?
Agreed. Not sure what would be more simple to implement.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 04, 2013, 02:36:30 pm
brynn, you just mentioned in your other thread that your gallery is bridged. In this case you probably need to adjust the group ID as described in the first post:
Quote
$groups = array(1); // enter the group IDs which should be allowed to set pictures as 'hot'
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 04, 2013, 02:45:03 pm
Is it possible to hide it in category view (keep only on main)?
Open codebase.php, find
Code: [Select]
$meta_album_name = 'hotpics';and above, add
Code: [Select]
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->keyExists('cat')) {
        return;
    }
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on November 05, 2013, 03:38:46 am
Uummm....ok, could you (or anyone) tell me where to find the group id, and tell me where to put it?  I don't know much about php.

My first guess was that I should replace the 1 with group id numbers.  But I can't find any numbers.  So maybe the group id is just the name of the group.  And in that case, I might guess that I should replace "groups" with the names of the groups.  But I really don't know.

Thanks for your help  :)
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on November 05, 2013, 04:10:35 am
Hi brynn,

Edit codebase.php

Set pictures as 'hot' for x days and display them in a meta album 'hotpics'.

you can change those buttons
Code: [Select]
$buttons = array(1, 2, 3); // each number will create a button 'Hot for x days'and also determine, which user groups will see the buttons
Code: [Select]
$groups = array(1); // enter the group IDs which should be allowed to set pictures as 'hot'

Group Admin = 1
Registered Group = 2
Guests Group = 3

Days for the buttons, for example: (7, 14, 21)

Regards.



Hello André
I would suggest that,

It would be interesting to registered users when they select one or more Hot pictures, these images are displayed in their personal gallery.
While, if the admin selects one or more Hot pictures these images are displayed only in the index.

Perhaps, display a message if the pictures exceeds the limit in the meta album also would be useful.

It also seems that there is a strange behavior with the buttons on the plugin when registered users activate a picture that they do not own.

Regards.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on November 05, 2013, 05:53:13 am
Hi brynn,

Edit codebase.php

Group Admin = 1
Registered Group = 2
Guests Group = 3

Days for the buttons, for example: (7, 14, 21)

Regards.

Thanks Niecher.  Based on that info, it would seem that I should already see buttons, since I am the admin, I'm logged on as admin, and the file already says:

Code: [Select]
$groups = array(1);
Should I enter some other number, since my gallery is bridged?

Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on November 05, 2013, 07:01:29 am
Try this:

Code: [Select]
$groups = array(0, 1);
Regards.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 05, 2013, 09:24:28 am
It would be interesting to registered users when they select one or more Hot pictures, these images are displayed in their personal gallery.
Not sure if I understood correctly what you suggest. Do you want to display the users' choice publicly to other users? If not, I don't get the difference to the Favorites meta album.


Perhaps, display a message if the pictures exceeds the limit in the meta album also would be useful.
Actually there are no limits for (meta) albums.


It also seems that there is a strange behavior with the buttons on the plugin when registered users activate a picture that they do not own.
Please describe more detailed.


I should already see buttons, since I am the admin, I'm logged on as admin, and the file already says:

Code: [Select]
$groups = array(1);
That just applies if the admin group in your board has also the ID "1" (like in an unbridged Coppermine gallery). As we cannot support third party apps, we cannot tell you how exactly you find out the admin group ID. Usually it's defined in the bridge file. Alternatively you could try to have a look at your browser's address bar while editing the admin group or have a look at the board's MySQL database. You should also make sure that your admin user is applied to the admin group as primary group.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: brynn on November 05, 2013, 09:56:33 am
Ah-HA!!

It looks like the admin's group id is 101, because replacing 1 with 101 has caused the buttons to finally appear!

Perhaps a note saying the the user id will probably be different in bridged galleries, would be helpful to include in the op.  And also possibly including:

Quote from: Andre
As we cannot support third party apps, we cannot tell you how exactly you find out the admin group ID. Usually it's defined in the bridge file. Alternatively you could try to have a look at your browser's address bar while editing the admin group or have a look at the board's MySQL database. You should also make sure that your admin user is applied to the admin group as primary group.

I actually found it by clicking the Assigned Albums button for the admin group, in the User Manager.  The proper value comes immediately after &gid= and before the next &, in the address bar....just in case others have the same issue.  I don't know if all SMF bridges will have that value or not, for the admin.


Hello André
I would suggest that,

It would be interesting to registered users when they select one or more Hot pictures, these images are displayed in their personal gallery.
....

I thought that's how it was supposed to work.  Otherwise, why give users the ability to choose which pics are hot?  You'd have users switching in their own hot pics constantly, theoretically.  But now that I finally have it working, I'll be able to figure out how it works.

Thanks for everyone's help  :)
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on November 05, 2013, 04:46:51 pm
Hello André,

Do you want to display the users' choice publicly to other users? If not, I don't get the difference to the Favorites meta album.
I think the plug-in should be a tool for that the registered user promotes those pictures most important for him, from his own personal gallery, showing these pictures in the index of his personal gallery.

Otherwise, the plug-in can be used as a tool to show the pictures than more likes the user registered (in whole gallery) and these images are displayed in the index of his personal gallery.

Two cases with different purposes.

For the administrator, the plug-in should be a tool that promotes those most important pictures of the gallery in general and these pictures will be displayed on the main index coppermine.

Favorites meta album is a private album, no one can see the pictures, only the owner (I see this so).

Actually there are no limits for (meta) albums.
The limit pictures to display is determined, if for example, we configure (hotpics,3) and (thumbcols = 3) then are displayed 9 pictures.

If we activate more pictures of this number, these no longer displayed.

My idea was to show a message that says something like "maximum pictures to activate (or to display): 9".

Please describe more detailed.
The strange behavior, I think it's because the user admin menu (edit, delete ... etc) is displayed to the user along with the buttons on the plug-in, for all the pictures in the gallery, even those pictures that user not is owner.

And if the user activates as Hot picture a picture that does is not his own, all user admin buttons for this picture, are not shown within the Hotpics meta album.

I think the buttons on the plug-in should only be displayed to the user in their own pictures.

And it being so, then the plugin can be a tool to promote the pictures that a user wants to promote from his personal gallery and these images are displayed in the index of the user's personal gallery.

Regards.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 06, 2013, 10:51:16 am
I think the plug-in should be a tool for that the registered user promotes those pictures most important for him, from his own personal gallery, showing these pictures in the index of his personal gallery.
That wasn't the initial purpose of the plugin and I'm not interested in modifying it accordingly, sorry.


The limit pictures to display is determined, if for example, we configure (hotpics,3) and (thumbcols = 3) then are displayed 9 pictures.

If we activate more pictures of this number, these no longer displayed.
Partly correct. You still can access the meta album via thumbnails.php?album=hotpics to see all pictures. That's why a message like "maximum pictures" may be misleading or confusing.


I think the buttons on the plug-in should only be displayed to the user in their own pictures.
If I remember correctly it should work this way.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Niecher on November 06, 2013, 10:27:59 pm
Yes the buttons work perfectly, I did not consider that I have some personal changes in my testbed.

I agree that the plug-in should be as you created it.

Thank you very much André.
Title: Re: Re: Hot pictures plugin for cpg1.5.x
Post by: mitko on November 23, 2013, 11:08:49 am
Open codebase.php, find
Code: [Select]
$meta_album_name = 'hotpics';and above, add
Code: [Select]
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->keyExists('cat')) {
        return;
    }

Thanks very much, Andre! That's work perfect.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: sharpo on November 23, 2013, 04:02:20 pm
Just tried installing this plugin, using the latest version 1.5 but get the errors mentioned on the first page of this topic:-



While executing query 'ALTER TABLE cpg15x_pictures ADD hot_expire int(11) default '0'' in plugins/hot_pictures/codebase.php on line 180

mySQL error: Duplicate column name 'hot_expire'

File: /home/transpor/public_html/sharpo.co.uk/cpg15test/include/functions.inc.php - Line: 270

Was I right in thinking v1.5 had corrected that problem when installing?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 23, 2013, 04:04:25 pm
Please delete the column "hot_expire" from your MySQL database and try again to install the plugin.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: sharpo on November 23, 2013, 05:14:52 pm
Thanks Αndré,

That was fast, I wasn't expecting a reply so soon.

I deleted the column and it now installs & I can see those little red flags. I can now give it a try and see if it will be useful in my other galleries.

Just wondering though, is there still a problem with the plugin code - as I had not attempted to use this plugin before and wondered what caused the "hot_expire" column to be created?
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 23, 2013, 05:33:06 pm
That column is solely created by this plugin, so you either installed it in the past and cannot remember or something went wrong during installation. I'm not aware that there's something wrong with the code.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: sharpo on November 23, 2013, 05:38:09 pm
I only noticed this plugin today when reading the forum, so it was the first ever install.
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: sharpo on November 23, 2013, 06:37:57 pm
Αndré,

Not a major problem, I notice that although "Hot pictures" appears above "Category" when viewing on my pc, but using mobil_light theme on my mobile there is no mention of "Hot pictures" at all. After the gallery description comes "Category".
Title: Re: Hot pictures plugin for cpg1.5.x
Post by: Αndré on November 23, 2013, 06:49:01 pm
Maybe meta albums are disabled for mobile themes. That's not related to this plugin, but the theme.
Title: Re: Re: Hot pictures plugin for cpg1.5.x
Post by: sharpo on November 23, 2013, 07:30:29 pm
Maybe meta albums are disabled for mobile themes. That's not related to this plugin, but the theme.
Yes, that was the answer, I added hotpics after breadcrumb in the configuration for that theme - and it worked.

Thanks - I'm learning all the time with your help!!!