bhavlice
Forum Replies Created
-
Forum: Plugins
In reply to: Multiple instances of the same widget on a singe page[Complete plugin file moderated. Please use the pastebin.]
Forum: Plugins
In reply to: Multiple instances of the same widget on a singe pagePlease give send me your email address and I’ll give you whatever code you want. Or, better yet, I can send you a .zip file so you can install it on your WordPress unit.
Bill
[email address moderated – this forum does not provide support via email]Forum: Plugins
In reply to: Multiple instances of the same widget on a singe pageThanks very much for the advice. I didn’t know that rule existed. I tried accessing the pastebin site but it seemed like such a hassle but I will revisit it. I have used this WordPress support in the past but only as a last resort and I’ve never added so much code. In any case, I modeled the parent function __construct() from a tutorial I purchased last year and it seems to work fine for a long period. I have also downloaded other code from widgets that use several instances of their widget on a single page and I’m looking into how they accomplished it. Therefore, I know it’s possible. I will defiantly keep everyone posted on what I find out and how I eventually get it to work. I can’t give up until it works because it is critical for the plugin to have this ability. The widget is currently installed on our test unit at: “http://1web.org/”. If you want to see it I can give you access. Just let me know.
Thanks again,
BillForum: Plugins
In reply to: Multiple instances of the same widget on a singe pageHere is the relevent code: I think it is the parent::__construct in public function __construct() may be the problem but I don’t know.
Perhaps the:
add_action( ‘widgets_init’, create_function( ”, ‘register_widget( “AdExchangeWidget” );’ ) );
may need to be altered somehow.
class AdExchangeWidget extends WP_Widget
{
public function __construct()
{
(
‘foo_widget’, // Base ID
‘PersonalAdNetworkExchangeWidget’, // Name
array( ‘description’ => __( ‘Personal Ad Network Exchange’, ‘text_domain’ ), ) // Args
);parent::__construct
}public function widget( $args, $instance )
{
//session_start();
extract( $args );
$title = apply_filters( ‘widget_title’, $instance[‘title’] );
$body = apply_filters( ‘widget_body’, $instance[‘body’] );
$activate = apply_filters( ‘widget_activate’, $instance[‘activate’] );
$_SESSION[‘AEActivate’] = $activate;
}public function form( $instance )
{
//session_start();if ( isset( $instance[ ‘title’ ] ) ) {
$title = $instance[ ‘title’ ];
}
else {
$title = __( ‘New title’, ‘text_domain’ );
}
?>
<p>
<label for=”<?php echo $this->get_field_id( ‘title’ ); ?>”><?php _e( ‘Title:’ ); ?></label>
<input class=”widefat” id=”<?php echo $this->get_field_id( ‘title’ ); ?>” name=”<?php echo $this->get_field_name( ‘title’ ); ?>” type=”text” value=”<?php echo esc_attr( $title ); ?>” />
<?php
if ( isset( $instance[ ‘body’ ] ) ) {
$body = $instance[ ‘body’ ];
}
else {
$body = __( ”, ‘text_domain’ );
}
?>
<p>
<label for=”<?php echo $this->get_field_id( ‘body’ ); ?>”><?php _e( ‘Description:’ ); ?></label>
<textarea class=”widefat” id=”<?php echo $this->get_field_id(‘body’); ?>” name=”<?php echo $this->get_field_name(‘body’); ?>”><?php echo esc_attr( $body ); ?></textarea>
</p>
<?php
if ( isset( $instance[ ‘activate’ ] ) ) {
$activate = $instance[ ‘activate’ ];
$_SESSION[‘AEactivate’] = $activate;
}
else {
$activate = “off”;
//$activate = __( ”, ‘text_domain’ );
$_SESSION[‘AEactivate’] = “off”;}
?><p>
<label for=”<?php echo $this->get_field_id( ‘activate’ ); ?>”><?php _e( ‘Activate:’ ); ?></label>
<input type=”checkbox” id=”<?php echo $this->get_field_id(‘activate’); ?>”
name=”<?php echo $this->get_field_name(‘activate’); ?>”<?php If($activate == “on”) echo “checked=’checked'”?>\><?php
//echo “Activate = ” . $activate . “”;
$_COOKIE[‘cookie’][‘AEactivate’]=$activate ;
//echo “<p>AEactivate COOKIE = ” . $_COOKIE[‘cookie’][“AEactivate”] . “”;$instance[ ‘format’ ] = “”;
If(isset( $instance[ ‘format’ ] ))
$instance[ ‘format’ ] = isset( $instance[ ‘format’ ]);
//echo ” <p>isset = ” . isset( $instance[ ‘format’ ] ) . “”;if ( isset( $instance[ ‘formatl’ ] ) ) {
//$format = __( ”, ‘text_domain’ );
$format = “on”;
}
else {
$format =”off”;}
//echo “Format = ” . $format . “”;
?><p>
<label for=”<?php echo $this->get_field_id( ‘format’ ); ?>”><?php _e( ‘Ad Format Form:’ ); ?></label>
<?php //echo “Format = ” . $format . “”; ?><?php //echo “SESSION Format = ” . $_SESSION[‘AEFormat’] . “”; ?>
<?php //echo “POST Format = ” . $_POST[‘AEFormat’] . “”;?><input type=”radio” id=”AEFormat” name=”AEFormat” <?php if($_POST[‘AEFormat’] == “AEWidget”) echo ‘checked=”checked”‘;?> value=”AEWidget” />Show In Widget
<input type=”radio” id=”AEFormat” name=”AEFormat” <?php if($_POST[‘AEFormat’] == “AEPopup”) echo “checked=’checked'”; ?> value=”AEPopup” />Show As Popup
<?php //echo “Format = ” . $format . “”; ?>
<?php If($_POST[‘AEFormat’]>””)
$_SESSION[‘AEFormat’] = $_POST[‘AEFormat’];
$_POST[‘AEFormat’] = $_SESSION[‘AEFormat’];
If($_POST[‘AEFormat’]<>$_SESSION[‘AEFormat’] or $_SESSION[‘AEFormat’]==””)
$_SESSION[‘AEFormat’] = $_POST[‘AEFormat’];
$_POST[‘AEFormat’] = $_SESSION[‘AEFormat’];//echo “<p>AEFormat COOKIE = ” . $_COOKIE[“AEFormat”] . “”;
If ($_POST[‘AEFormat’]==””)
{
$_POST[‘AEFormat’]= $_COOKIE[‘cookie’][‘AEFormat’] ;
$_SESSION[‘AEFormat’] = $_POST[‘AEFormat’];
}
?><?php
$instance[ ‘present’ ] = “”;
If(isset( $instance[ ‘present’ ] ))
//$instance[ ‘format’ ] = isset( $instance[ ‘present’ ]);
//echo ” <p>isset = ” . isset( $instance[ ‘present’ ] ) . “”;
?><p>
<label for=”<?php echo $this->get_field_id( ‘present’ ); ?>”><?php _e( ‘Ad Display Format:’ ); ?></label>
<?php //echo “Format = ” . $present . “”; ?><?php //echo “SESSION Display = ” . $_SESSION[‘AEDisplay’] . “”; ?>
<?php //echo “POST Display = ” . $_POST[‘AEDisplay’] . “”;?><input type=”radio” id=”AEDisplay” name=”AEDisplay” <?php if($_POST[‘AEDisplay’] == “AESlideshow”) echo ‘checked=”checked”‘;?> value=”AESlideshow” />Display Ads as a SlideShow
<input type=”radio” id=”AEDisplay” name=”AEDisplay” <?php if($_POST[‘AEDisplay’] == “AEStatic”) echo “checked=’checked'”; ?> value=”AEStatic” />Display Ads as Static<?php //echo “DisplayFormat = ” . $display . “”; ?>
<?php If($_POST[‘AEDisplay’]>””)
$_SESSION[‘AEDisplay’] = $_POST[‘AEDisplay’];
$_POST[‘AEDisplay’] = $_SESSION[‘AEDisplay’];
If($_POST[‘AEDisplay’]<>$_SESSION[‘AEDisplay’] or $_SESSION[‘AEDisplay’]==””)
$_SESSION[‘AEDisplay’] = $_POST[‘AEDisplay’];
$_POST[‘AEDisplay’] = $_SESSION[‘AEDisplay’];//echo $_COOKIE[‘AEFormat’];
//echo “<p>AEFormat COOKIE = ” . $_COOKIE[‘AEFormat’] . “”;If ($_POST[‘AEDisplay’]==””)
{$_POST[‘AEDisplay’] = $_COOKIE[‘cookie’][‘AEDisplay’];
$_SESSION[‘AEDisplay’] = $_POST[‘AEDisplay’];
}
?><?php //echo “POST Display = ” . $_POST[‘AEDisplay’] . “”; ?>
<?php //echo “SESSION Display = ” . $_SESSION[‘AEDisplay’] . “”; ?><?php
if ( isset( $instance[ ‘detail’ ] ) ) {
//$detail = __( ”, ‘text_domain’ );
$detail = “on”;
$_SESSION[‘AEDetail’] = $detail;
}
else {
$detail =”off”;
$_SESSION[‘AEDetail’] = “off”;}
//echo “Detail = ” . $detail . “”;
$_COOKIE[‘cookie’][‘AEdetail’]=$detail ;
//echo “<p>AEdetail COOKIE = ” . $_COOKIE[‘cookie’][‘AEdetail’] . “”;
$_SESSION[‘AEdetail’]=$_COOKIE[‘cookie’][‘AEdetail’];
?><label for=”<?php echo $this->get_field_id( ‘detail’ ); ?>”><?php _e( ‘Show Detail:’ ); ?></label>
<input type=”checkbox” id=”<?php echo $this->get_field_id(‘detail’); ?>”
name=”<?php echo $this->get_field_name(‘detail’); ?>” <?php If($detail == “on”) echo “checked=’checked'”?>\><?php
session_start();
if (isset($_COOKIE[‘cookie’]))
{
foreach ($_COOKIE[‘cookie’] as $name => $value)
{
//echo “”;
$name = htmlspecialchars($name);
$value = htmlspecialchars($value);
//echo ” $name : $name “;
//echo ” $value : $value “;
}}
//echo “SESSION AEactivate = ” . $_SESSION[‘AEactivate’] . “”;
//echo “SESSION Format = ” . $_SESSION[‘AEFormat’] . “”;
//echo “SESSION Display = ” . $_SESSION[‘AEDisplay’] . “”;
//echo “SESSION AEdetail = ” . $_SESSION[‘AEdetail’] . “”;
//echo “COOKIE AEFormat = ” . $_COOKIE[‘cookie’][‘AEFormat’] . “”;
//echo “COOKIE AEDisplay = ” . $_COOKIE[‘cookie’][‘AEDisplay’] . “”;
}}
add_action( ‘widgets_init’, create_function( ”, ‘register_widget( “AdExchangeWidget” );’ ) );
Forum: Networking WordPress
In reply to: Remote Mysql loginThe remote server is running MySQL 5.0.45 WP 3.1.3
My development server where the call is being made is running MySQL 5.5.8 and PHP 5.3.5 WP 3.1.3Hope this helps,
BillForum: Networking WordPress
In reply to: Remote Mysql loginGood points. Here’s the story.
My Plugin is connected to a retail/bidding site that is very successful. It is crucial that I track the users of the plugin with unique IDs that need to be held in a single consolidated database repository that our plugin uses and controls so that when users communicate with the store site we are linking to they are identified with their ID and parameters that need to be passed in order to return a page with the resulting data set. Thus, I need to have each user add/modify/delete information in the remote Mysql database. The problem is that I cannot currently access the remote site with the connection string containing the IP and Port address of the remote server. For some reason that is still unclear, the password encryption does not seem to work with the PHP version 5.3+ that we currently use. It appears that the new PHP versions use a different password encryption method. Somehow, I need to revert to the old encryption method before sending the connection string to make it work. So far, the response I’m getting from my exhaustive search on this problem, either doesn’t work or is unacceptable. I, for the life of me, do not understand why a new version of PHP is incompatible with older versions. Backwards compatibly is the usual norm. That is the dilemma.
Thank you in advance for any help,
BillForum: Networking WordPress
In reply to: Remote Mysql loginUnfortunately, I don’t think that we are not on the same page. It seems to be a password issue not a Mysql server issue. I have defined the HOST with the IP and port# which is when I get the error I first submitted regarding the password. I appreciate your help but think I should post this on other forums as well.
Thanks, again you have been very helpful. If you hear of anyone else having this problem, I would apprciate a heads up.
Bill
Forum: Networking WordPress
In reply to: Remote Mysql loginI’m running version 5.5.8 where I get the error.
I’m using:$con=mysql_connect(‘70.87.224.194:3306’,DB_USER,DB_PASSWORD);
This works fine for localhost but not for a remote server. The problem is the password. 5.2+ seems to require an encripted password with a 24 character length instead of the old 12 character length in 4.1.
It just seems like a simple change needs to be made. But I don’t know what needs to be done. Do you know anyone doing this?
Bill
Forum: Networking WordPress
In reply to: Remote Mysql loginThis is a Mysql problem. I need to login to a remote server using the php mysql_connect function in WP. I believe it is a problem with the encryption of passwords. I just can’t believe that developers don’t use a remote MySql server if they want multiple WP sites to store user and other information in one database.
Forum: Themes and Templates
In reply to: Use themes in pluginsThank you very much for the information. If there is anything I can do to help you with anything, I would be more than happy to do so. Thanks again.
Forum: Themes and Templates
In reply to: Use themes in pluginsExactly! is that possible?
You sound like you know your stuff. What is your email direct email address? Mine is: [email removed]. Are you on linked in? I’m sort of new to PHP. I’ve made a living off of .NET for years.Forum: Themes and Templates
In reply to: Use themes in pluginsSorry. I didn’t mean a theme of it’s own. I wanted to emulate the current theme the plugin user is using into my plugin pages. Is this even possible?
Thanks,
BillForum: Themes and Templates
In reply to: Use themes in pluginsHow do I incorporate a theme into my plugin pages?