CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • CiviContribute Widget not working - CiviCRM 4.1.alpha2 / Wordpress 3.3
Pages: [1]

Author Topic: CiviContribute Widget not working - CiviCRM 4.1.alpha2 / Wordpress 3.3  (Read 1020 times)

nextwave

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 0
CiviContribute Widget not working - CiviCRM 4.1.alpha2 / Wordpress 3.3
December 22, 2011, 06:55:44 am
In Chrome the Javascript console outputs this -

Code: [Select]
Uncaught SyntaxError: Unexpected token <     (widget.php:1)

So I opened up the widget file and get this -

Quote
Warning: require_once(civicrm.config.php) [function.require-once]: failed to open stream: No such file or directory in /home/user/wp/wp-content/plugins/civicrm/civicrm/extern/widget.php on line 36

Fatal error: require_once() [function.require]: Failed opening required 'civicrm.config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/wp/wp-content/plugins/civicrm/civicrm/extern/widget.php on line 36


So in the widget.php file past the copyright the file looks like this -

Code: [Select]
<?php

require_once 'civicrm.config.php';
require_once 
'CRM/Core/Config.php';

$config   = CRM_Core_Config::singleton( );
$template = CRM_Core_Smarty::singleton( );

require_once 
'CRM/Utils/Request.php';
$cpageId  = CRM_Utils_Request::retrieve( 'cpageId',  'Positive', CRM_Core_DAO::$_nullObject );
$widgetId = CRM_Utils_Request::retrieve( 'widgetId', 'Positive', CRM_Core_DAO::$_nullObject );
$format   = CRM_Utils_Request::retrieve( 'format',   'Positive', CRM_Core_DAO::$_nullObject );

require_once 
'CRM/Contribute/BAO/Widget.php';

$jsonvar = 'jsondata';
if ( isset( 
$format ) ) {
    
$jsonvar .= $cpageId; 
}

$data = CRM_Contribute_BAO_Widget::getContributionPageData( $cpageId, $widgetId );

$output = '
    var '
.$jsonvar.' = '.json_encode( $data ) .';
'
;

echo 
$output;
CRM_Utils_System::civiExit( );


Why do other files work with the relative paths, but this one doesn't?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviContribute Widget not working - CiviCRM 4.1.alpha2 / Wordpress 3.3
December 22, 2011, 07:06:09 pm
Looks like widget is broken in wordpress. filed: http://issues.civicrm.org/jira/browse/CRM-9385

Quote
Why do other files work with the relative paths, but this one doesn't?
Widget provides a code/html snippet which you can paste on same or any other website, hence all the path's cannot be relative.

Hth
Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • CiviContribute Widget not working - CiviCRM 4.1.alpha2 / Wordpress 3.3

This forum was archived on 2017-11-26.