Announcement

  •  » Extensions
  •  » Mugshot gives php Warnings on every page

#1 2019-08-05 12:39:45

JohnB
Member
2019-08-02
16

Mugshot gives php Warnings on every page

I've tried switching from facetag to MugShot to take advantage of its extra features, but I get at the start of every page

Warning: count(): Parameter must be an array or an object that implements Countable in /home/johnbray/piwigo.fancy-test.com/plugins/MugShot/main.inc.php on line 163

Warning: Cannot modify header information - headers already sent by (output started at /home/johnbray/piwigo.fancy-test.com/plugins/MugShot/main.inc.php:163) in /home/johnbray/piwigo.fancy-test.com/include/page_header.php on line 101

(I have disabled facetag, in case they fight)

John

Offline

 

#2 2019-08-06 08:36:18

JohnB
Member
2019-08-02
16

Re: Mugshot gives php Warnings on every page

It would be helpful to have the forum default post template mention that this config information can be found at Tools/Maintenance, as its off-putting to find each value manually.

    Piwigo 2.9.5
    Operating system: Linux
    PHP: 7.2.19 (Show info) [2019-08-05 23:32:37]
    MySQL: 5.7.25-log [2019-08-05 23:32:37]
    Graphics Library: ImageMagick 6.9.7-4

Offline

 

#3 2019-08-06 18:12:56

dd-b
Member
Minneapolis, MN USA
2018-04-16
69

Re: Mugshot gives php Warnings on every page

I have something very slightly different; in my case,

Code:

Warning: array_intersect(): Argument #1 is not an array in /home/dh_akhcfg/gal01.dd-b.net/piwigo/plugins/MugShot/main.inc.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at /home/dh_akhcfg/gal01.dd-b.net/piwigo/plugins/MugShot/main.inc.php:45) in /home/dh_akhcfg/gal01.dd-b.net/piwigo/include/page_header.php on line 101

In this installation, face tag was never installed, I went straight to Mug Shot.

My environment:


    Piwigo 2.9.5
    Operating system: Linux
    PHP: 7.0.33 (Show info) [2019-08-06 09:13:09]
    MySQL: 5.7.25-log [2019-08-06 09:13:09]
    Graphics Library: ImageMagick 6.9.7-4

Last edited by dd-b (2019-08-06 18:14:02)

Offline

 

#4 2019-08-06 18:40:14

dd-b
Member
Minneapolis, MN USA
2018-04-16
69

Re: Mugshot gives php Warnings on every page

And the warnings do go away again when I deactivate Mug Shot.

Offline

 

#5 2019-08-07 17:16:09

dd-b
Member
Minneapolis, MN USA
2018-04-16
69

Re: Mugshot gives php Warnings on every page

Mug shot doesn't seem to work even in a new, clean, install.

Code:

Warning: array_intersect(): Argument #1 is not an array in /home/dh_akhcfg/gal01.dd-b.net/plugins/MugShot/main.inc.php on line 45

Notice: Use of undefined constant PSHARE_ADMIN_BASE_URL - assumed 'PSHARE_ADMIN_BASE_URL' in /home/dh_akhcfg/gal01.dd-b.net/plugins/MugShot/admin.php on line 61

Warning: Cannot modify header information - headers already sent by (output started at /home/dh_akhcfg/gal01.dd-b.net/plugins/MugShot/main.inc.php:45) in /home/dh_akhcfg/gal01.dd-b.net/include/page_header.php on line 101

Offline

 

#6 2019-08-07 17:23:43

dd-b
Member
Minneapolis, MN USA
2018-04-16
69

Re: Mugshot gives php Warnings on every page

Face tag does seem to work, so I'm proceeding with that for the moment.

Offline

 

#7 2019-11-15 15:56:59

Radjin
Member
2019-08-13
10

Re: Mugshot gives php Warnings on every page

Any word of a fix for MugShot?

Offline

 

#8 2020-10-08 23:20:21

drewlander
Member
2020-10-07
20

Re: Mugshot gives php Warnings on every page

looks like you need to have piwigo private share plugin installed for the constant PSHARE_ADMIN_BASE_URL.

Offline

 

#9 2020-10-08 23:26:15

drewlander
Member
2020-10-07
20

Re: Mugshot gives php Warnings on every page

Im posting in this thread as well as the other I had been discussing mugshot plugin so this is easy to find.

You need to install Private Shares plugin. Create a group. Edit your user. Add them to the group. Now mugshot works. I was able to click the mugshot icon, select on the picture, set a tag, and save.

Offline

 

#10 2020-10-16 18:30:34

lb483
Member
2020-10-13
3

Re: Mugshot gives php Warnings on every page

The "solution" I found was to fix the bug in the plugins/MugShot/main.inc.php file:

from:

Code:

/*
 * Conditional Logic for groups
 */
$current_user_groups = query_mugshot_groups();
if ($current_user_groups != 0) {
  $plugin_config = unserialize(conf_get_param(MUGSHOT_ID));
  $group_list = $plugin_config['groups'];
  $intersect = array_intersect($group_list, $current_user_groups);
}

to:

Code:

/*
 * Conditional Logic for groups
 */
$current_user_groups = query_mugshot_groups();
if (!empty($current_user_groups))
{
  if (count($current_user_groups) != 0) {
    $plugin_config = unserialize(conf_get_param(MUGSHOT_ID));
    $group_list = $plugin_config['groups'];
    $intersect = array_intersect($group_list, $current_user_groups);
  }
}

and to ensure that at least one group was specified for the MugShot plugin through Admin/Plugins/MugShot

Until a group is defined, errors will occur on some screens.

Also I'm getting errors on the plugin management page for the deprecated create_function() but I'm not a PHP expert so I'm not looking to fix everything - and the fix above makes MugShot work for me.


Piwigo 2.10.2
Operating system: Linux
PHP: 7.3.7 [2020-10-17 00:29:16]
MySQL: 5.5.57-MariaDB [2020-10-16 17:29:16]
Graphics Library: ImageMagick 6.9.4-8

Offline

 

#11 2020-10-16 18:51:44

drewlander
Member
2020-10-07
20

Re: Mugshot gives php Warnings on every page

we posted that fix in a different thread. Below is how to create that anonymous function. 


$tab_codes = array_map(function ($a) { return $a['code']; }, $tabs);



here is the other thread.
https://piwigo.org/forum/viewtopic.php?id=30647&p=1

Offline

 

#12 2020-10-16 20:10:22

dd-b
Member
Minneapolis, MN USA
2018-04-16
69

Re: Mugshot gives php Warnings on every page

I've also found a smaller problem where the mugshot icon is displayed the wrong size in the wrong place when the *default* theme is Bootstrap but the current theme is something else (there's theme-specific layout code). Easy fix for me, for now, was to have just the one theme available :-).  But I know what's going on underneath and will eventually take it on directly. There's a general issue with theme compatibility, which doesn't seem to have one root cause (except, perhaps, that themes have rather too much leeway in how they do things).  But at least a few of the individual things can probably be fixed, and at least the themes it's incompatible with can be documented more accurately.

I tried a direct email to the mugshot author, but no response so far. I've pushed my fixes so far to my fork of mugshot on github, but haven't looked into registering my fork as an official piwigo extension yet (it's not really ready for that anyway).

Offline

 
  •  » Extensions
  •  » Mugshot gives php Warnings on every page

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact