Announcement

#1 2013-04-30 12:38:36

twphotouk
Guest

"Header already sent" using Contact Form and Social Buttons Plugins

Hi - using the Contact Form plugin with Social Buttons plugin activated yields this message after sending the email:

Warning: Cannot modify header information - headers already sent by (output started at /home/blah/public_html/piwigo/plugins/SocialButtons/include/google.inc.php:48) in /home/blah/public_html/piwigo/include/page_header.php on line 101

It appears on the intermediate redirection page above the page header and  "Redirection...
Click here if your browser does not automatically forward you "

The redirection to the next page does work, so the warning message only appears briefly, unless you press <Escape> quite briskly. 

Versions:
Piwigo 2.5.1
Both plugins current on 2013/04/30

 

#2 2013-04-30 15:56:20

flop25
Piwigo Team
2006-07-06
7037

Re: "Header already sent" using Contact Form and Social Buttons Plugins

Hello
usually that's an error caused by the display of an error : so are you sure there is no other msg displayed too? Display the source code (Ctr+U usually)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2013-05-01 03:23:18

twphotouk
Guest

Re: "Header already sent" using Contact Form and Social Buttons Plugins

Hi

Thanks for your response.  I have two nearly identical websites with Piwigo installed on each.  The problem only occurs on one site, and the most likely difference is in which plugins are installed/activated.
I'll try to isolate exactly which combination of plugins causes the error tomorrow.  Both sites have Contact Form and Social Buttons activated.

For the site on which the error does occur, I cannot see any other error messages, just the warning that the header had already been written.  A further clue:  on the contact form, if I select the tick box "Send copy to my email", the Piwigo header appears on the page twice (two emails are sent). If the tick box is not selected, the Piwigo header appears only once.

The site with no problem has these active plugins:
Add Users Notes
Additional Pages
Admin Messages
AStat.2
Contact Form
Crypto Captcha
Embedded Videos
Grum Plugins Classes.3
Guest View Thumb Only (modified)
Linked Pages
LocalFiles Editor
Social Buttons
videojs

The site which DOES have the problem, has these active plugins:
Contact Form
Crypto Captcha
Embedded Videos
Event tracer
Guest View Thumb Only (modified)
Language Switch
LocalFiles Editor
Social Buttons
videojs

 

#4 2013-05-01 07:00:32

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: "Header already sent" using Contact Form and Social Buttons Plugins

Hi :-)

twphotouk wrote:

Guest View Thumb Only (modified)

code ?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#5 2013-05-01 11:58:58

flop25
Piwigo Team
2006-07-06
7037

Re: "Header already sent" using Contact Form and Social Buttons Plugins

Well you have to disable one by one the plugins to see where the problem is


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#6 2013-05-01 16:36:39

twphotouk
Guest

Re: "Header already sent" using Contact Form and Social Buttons Plugins

ddtddt wrote:

Hi :-)

twphotouk wrote:

Guest View Thumb Only (modified)

code ?

My changes limit the size of album/category images to a max of thumbnail for guests, in addition to limiting the size of individually viewed pictures as did the original plugin.   That part would be suitable to merge into the plugin. 

In addition, I allow guests to view full size images of albums with permisions for a group named 'visitor_public'.  Probably that part is not suitable for merge in.  In fact probably I would have been better off using the "who can see this" access mechanism for Evenerybody/Frieds/Family etc. but I didn't understand it when I started.

Btw - I am a bad, greedy and selfish person.  I like using free and open software, but contributing?  It hurts not to be paid!

Code:

<?php
/*
Plugin Name: Guest View Thumb Only  - Modified by twphotouk
Version: 2.5.a.modified
Description: Users only have access to thumbnails
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=607
Author: Piwigo
Author URI:http://piwigo.org/ext/extension_view.php?eid=607
*/

add_event_handler('loc_begin_picture', 'picture_guest_denied');
add_event_handler('get_index_derivative_params', 'index_derivative_guest_type');


function picture_guest_denied()
{
  global $user;
  if (is_a_guest() && !isCurrentCategoryPublic()) access_denied();
}

function index_derivative_guest_type($type)
{
  global $user;

  $rtn = $type;
  // Allow guests to see IMG_SQUARE and IMG_THUMB, but not larger images
  // as index images for an album.
  if (is_a_guest() && !isCurrentCategoryPublic()) {
     if ($type != ImageStdParams::get_by_type( IMG_SQUARE )
       && $type != ImageStdParams::get_by_type( IMG_THUMB ))
     {
       $rtn = ImageStdParams::get_by_type( IMG_THUMB );
     }
  }  
  return $rtn;
}

function isCurrentCategoryPublic()
{
  global $page;
  //$page['category']['id']  Not defined for other views, e.g. most recent pics
  $isCategoryPublic = false;
  if (isset($page['category']) && isset($page['category']['id']))
  {
      $isCategoryPublic = isCategoryAccessibleByGroup($page['category']['id'],"visitor_public");
  }
  return $isCategoryPublic;
}

function isCategoryAccessibleByGroup($category_id, $groupName)
{
    $query = "SELECT g.id from ".GROUPS_TABLE." g INNER JOIN ".GROUP_ACCESS_TABLE." ga ON g.id=ga.group_id 
where 
ga.cat_id='$category_id' and g.name='$groupName'";

    $cat = pwg_db_fetch_assoc(pwg_query($query));
    return !empty($cat);
}

?>
 

#7 2013-05-01 17:09:18

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: "Header already sent" using Contact Form and Social Buttons Plugins

ddtddt wrote:

code ?

@twphotouk
if only for help you to debug ;-)


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#8 2013-05-01 17:35:39

twphotouk
Guest

Re: "Header already sent" using Contact Form and Social Buttons Plugins

flop25 wrote:

Well you have to disable one by one the plugins to see where the problem is

With all plugins disabled, except Contact Form and Social Buttons, the warning message still appears.  The only two differences I can see are:

1. that on this site (with the error) the twitter button has a "1" next to it, because I had successfully tested sending a tweet some time ago.  On the other site, the twitter button has "0" next to it.   I just tried sending a tweet from that site, but it does not seems to register and a "0" still appears next to the twitter button.

2. on the site with the error, within the Contat Form admin page tab <Email> I had added two categories for two separate email addresses ("Tech" and "Art").  I deleted them (and the categories) so at least in the UI it appears as in the working site, and retested, but the warning message still apprears.

 

#9 2013-05-01 17:39:10

twphotouk
Guest

Re: "Header already sent" using Contact Form and Social Buttons Plugins

ddtddt wrote:

ddtddt wrote:

code ?

@twphotouk
if only for help you to debug ;-)

Understood.  I'm pretty sure the problem mentioned here is not caused by my changes to the guest_thumbnail plugin.

 

Board footer

Powered by FluxBB

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