Forum Replies Created
-
AuthorPosts
-
sparkitMember
Sticking to what i said earlier, here is what i have done: these are fairly simple changes that others might want to implement.
1 – Total number of clicks (placed at the top of the table).
in the clicktrhoughs_menu.php there are two functions: one lists clicks by dates and the other only shows the last 100 clicks.
in both, the statement which performs the query is the one starting with the following:
$wp_aff_clicks_db = $wpdb->get_results("SELECT * FROM wp_2_affiliates_clickthroughs_tbl WHERE
to get the totals it is easy to use the defaul WP database interrogation and in this example i print it at the top of the table.
$tot_wp_aff_clicks = $wpdb->get_var($wpdb->prepare("SELECT Count(*) FROM wp_2_affiliates_clickthroughs_tbl"));
echo '<br>Total clicks: </br>' . $tot_wp_aff_clicks;
2- Display different queries.
The way i have done it (by no mean the only way of doing this!) is to add a set of links at the top of the page with an additional url parameter
for example:
<a href="admin.php?page=clickthroughs&clickFilter=1">Last 200</a>
then in the last else statement of the main function i check the url parameter:
if ($_GET["clickFilter"]=='1') {
show_last_clickthroughs();
}this statement shows the existing function with the last 100, but by modifying the query in the function i have also produced a table with the summary of clicks by affiliate like in the following function:
function show_Summary_clickthroughs()
{
echo '<div id="message" class="updated fade"><p><strong>';
echo 'Displaying Total clicks by AFFILIATE';
echo '</strong></p></div>';
// NOTE that this has the same structure as the default function, but only shows 5 columns
echo '
<table class="widefat" width="50%">
<thead><tr>
<th scope="col">'.__('Affiliate ID', 'wp_affiliate').'</th>
<th scope="col">'.__('Total Clicks', 'wp_affiliate').'</th>
<th scope="col">'.__('Impact % value', 'wp_affiliate').'</th>
<th scope="col"></th>
<th scope="col"></th>
</tr></thead>
<tbody>';
global $wpdb;
global $affiliates_clickthroughs_table_name;
// next two lines shows the total clicks
$tot_wp_aff_clicks = $wpdb->get_var($wpdb->prepare("SELECT Count(refid) as 'totalclicks' FROM wp_2_affiliates_clickthroughs_tbl"));
echo '<br>Total clicks: </br>' . $tot_wp_aff_clicks;
// this is the actual query
$wp_aff_clicks_db = $wpdb->get_results("SELECT refid, Count(refid) as 'total', (Count(refid) * 100) as 'impact' FROM wp_2_affiliates_clickthroughs_tbl GROUP BY refid", OBJECT);
if ($wp_aff_clicks_db)
{
foreach ($wp_aff_clicks_db as $wp_aff_clicks_db)
{
echo '<tr>';
echo '<td>'.$wp_aff_clicks_db->refid.'</td>';
echo '<td><strong>'.$wp_aff_clicks_db->total.'</strong></td>';
echo '<td><strong>'. round(($wp_aff_clicks_db->impact) / ($tot_wp_aff_clicks), 2).'</strong></td>';
echo '<td></td>';
echo '<td></td>';
echo '</tr>';
}
}
else
{
echo '<tr> <td colspan="5">'.__('No Click Data Found.', 'wp_affiliate').'</td> </tr>';
}
echo '</tbody>
</table>';
}
i hope that others will find it useful and feedback is very much appreciated!
sparkitMemberhi, there is no other outlet to express this so feel free to remove the whole thread if you want, however i strongly believe that your statement here is damaging your position with customers and the use of the forum itself.
if you look at the history of my posts, *i have already received very valuable answers* in the past and the efforts of the moderators are very much appreciated!
like me, many are learning more about how the plugin works and how small customisation can be added from the forum answers.
The forum is a *community space* where people like me, not programmers but willing to make an extra effort, are asking questions, learning from you and the others and share ideas and tricks to adapt your product for their needs.
you seem to have taken a different view: however the forum is not a ticketing support system (i.e. one way communication with question from customer -> official answer from you) but you seem to enforce this with rules making it like it… if you restrict it you completely lose touch with what customers need and ultimately stifle your developments
this thread is an example of what a forum post *should not* be like as absolutely nothing can be learnt in relation to my original question!
said this, shall we rewind and go back to the original question?
sparkitMemberthat’s not very useful as answer!
maybe i didn’t make it too clear from the message, but it’s not just ‘hooking the function to the button’.
what i was after is a better understanding of how to make a second function, one which filters things differently from the default one, fit in the logic of the plugin, and that’s where i was looking for advice!
doing a google search is not going to tell me an aswer about that…
furthermore, this is the ‘tweaks’ thread: surely discussing how to extend the way clicktrhough is displayed for admins is useful and interesting for the others reading as well?!
sparkitMemberi know we are on a different timezone so you will probably get to my message at some point later. in the meantime, i thought to let you know that i have used a workaround to ‘rewrite’ all links with javascript. so if there is an ap_id in the url i use that to attach it as parameter to all links when the page loads, otherwise a default affiliate_id is used.
this is quite simple yet nifty as basically no code change is required from the plugin side. the js is embedded in the header of the theme and all is done!
sparkitMemberthanks for confirming this as it was what i understood the plugin was going to do, however it doesn’t seem to be what the plugin actually does (note i have the latest version of WP 3.1 and the latest version of the plugin).
can you please tell me where the cookie is set? i can then run a few checks to see where the info is lost and give you more debugging info.
the reason why i am asking is that it doesn’t look from the admin table nor the affiliate side that all clicks are registered (as i thought it would happen)
a separate ‘display’ question is: am i right in believing that the last 20 clicks that affiliates can see only include the ‘direct’ refererrals? (i’m assuming not, but what i observe is the consequence of missing recorded clicks)
i have looked at the actual database and it looks to me like only the first click is recorded, not all clicktrhough. at this point this is an unexpected problem
thanks!
sparkitMemberhi, thanks for the response; indeed that’s the same methods i tried first, but there is a big limitation in the sense that you have to ‘wrap the code’ in a div or span (see earlier).
if you have a ‘template’ for a newsletter, however, you will be likely to have a full html doc in the textarea. this is where the solution you suggest breaks (i tried that already
what i’m playing with at the moment is a simple WYSIWYG editor, stripped of all the buttons except for the source/html one. this seems to do the job, but i’m trying o figure out how to pass the stuff between jscript and php as only the top row is working now…
furthermore depending on the content the preview will be ‘ugly’ as it must fit in the box area (full screen preview is another option)
as i said earlier the simplest solution would be to be able to add a picture preview of the code (which makes the creatives similar to the ads).
sparkitMemberhi, sorry, one more question as i’m double checking all the places where the add/edit details is fired.
if not the user, but the admin is adding/updating the details from the wordpress backend manually, could you please confirm where is the function(s) that does this?
another question which is coming to my mind is the following. i understand the logic about why you would want to have separate users for the affiliate programs and WP users, but don’t you think it would be quite easy for someone logged in as member to want to become affiliate?
how would you go about adding a third option in the front page asking something like ‘register using your WP user’: this is basically a check if the user is logged in WP, then check whether the users’ email is already in the AP table anfd, if yes log in automatically, otherwise and query the database user details and populate them into the affiliates reg form. does it make sense to you?
much appreciating your opinion and help so far!
sparkitMemberShadowbox can definitely handle html/php as you can open entire pages in the box. i use it all the time and it is the same principle used to preview themes and plugin info in wordpress.
the standard call is something like the following which i also set the size of:
<a href="http://mysite.com/page.php" rel="shadowbox;height=600;width=850">
the problem is that it opens an existing page, what i have not been able to figure out is how to make things dynamic and pass the code from the text area into a page -we have established that partial code will not work- and maybe you have some suggestions as you know better how the code works.
if i’m creating ‘preview’ pages dynamically when the creatives.php is opened this might not be the best way as i could have a few rows, but i could have many. the ‘name’ of each creative is linking to the page and solves the problem.
an alternative would be to dynamically ‘write’ the code into a single empty container page from the array of creative names, but is this not a security risk opening the code to injection?
so basically i build an array of creatives and the corresponding code (or query directly from the $resultset you have if the ID is made available to the actual link), write the code to the container page on click and then page is opened in the box for preview.
does it make sense at all?
a completely different solution i was looking at is the WYSIWYG editors option to turn the text area from source to normal view; do you think this could be easier to implement?
sparkitMemberis not doing very well as it depends very much upon the type of content. i’ve got a 600px table which can be used as footer, so the preview is a nightmare!
here is the code i’ve got for creating the rows:
foreach ($resultset as $resultset)
{
if($resultset->creative_type =="3")
{
$ad_code = str_replace("xxxx",$_SESSION,$resultset->description);
$ad_code = str_replace("XXXX",$_SESSION,$ad_code);
$demoCode= html_entity_decode($ad_code, ENT_COMPAT,"UTF-8");
echo '<tr>';
echo '<td class="col2">'.$resultset->name.'';
echo '<div id="lightbox" style="display:none;"><div id="lightbox-content" style="padding:20px;color:white;">'.$demoCode.'</div></div>';
echo '<div class="bubbleInfo">
<img class="trigger" src="images/demo.gif" />
<div class="popup"> Demo window </div>
</div></td>';
echo '<td><textarea cols=65 rows=5>';
echo $ad_code;
echo "</textarea></td>";
echo '</tr>';
}
}
as you can see i tried to pass on the ‘rendered’ code into a shadowbox frame (same as the wordpress theme), but nothing is displayed in the frame itself and by looking at the source code the html has not been decoded at all.
so, my thinking is that the easiest way might be to use the same stuff currently working for the banners: would you be able to modify the creatives code to add a preview image to be uploaded when the creative is added?
this way there are no rendering issues and if people want the preview they can add the picture.
sparkitMemberspot on and very prompt as usual!! thanks.
can i just double check with you if i get things right: i want to check whether the current visitor is logged in. if i get it right there is a function you use is in the mics_functions?
i tried to echo the ccokie variable $_SESSION;
from the header.php, but it didn’t work… what is the the actual session variable? can i pull the logged in user ap_id and full name?
thanks
sparkitMemberhi, this was great and very helpful!
one more question: obviously something similar is done when a user update their details. could you point me to where the update funcion is so that i can fire my update commands?
thanks!
sparkitMembersorry, i’ve got another question about this: i looked at the file, but i am still a bit puzzled about it as i was expecting to be able to pull the content from the form fields but as far as i understand things are added in the db already at this point.
would you be able to give me a quick example of how you refer to the following from here without making a new database call interrogating the affiliate table?
i would need: first name, last name, email and affiliate id (then i’ve got a function which does the job of passing stuff to the other system).
many thanks!
sparkitMemberThanks for the tips. There is also another simple option to avoid confusing users when new registration is blocked: if you use div you can simply set it to hidden after checking the flag from the configuration and show your message.
Back to the original query, where should I look for to pass on the details of a new reg into the crm? I’ve got some functions to pass the stuff, but you will save me a lot of time if you can point me to where/ when data is inserted in the db after submission from both admin and from the reg form.
sparkitMemberi’m on the standalone version, but, just in case, i’ve got a multisite installation of WP. (haven’t tried what’s happening if i activate the plugin on more than one site though! – and would be curious to know whether every site would have its own affiliate database tables or if it goes all in one across the base WP installation)
an interesting thing which doesn’t make much sense in the registration: why the message ‘Affiliate account signup option is disabled. Please contact the admin.’ in register.php comes up at the bottom of the form?
[suggestion: as plugin improvement, surely you can catch if the flag is off already from the head of files and redirect to a page which doesn’t even display the signup form, or at least move it at the top of the page?]
how difficult would it be to implement an approval system for affiliate requests? i know that you have done every effort to make it non-spammy, but inevitably there will be some who exploit the system maliciously. something like the WP comment approval would be great!
by the way, do you have any plan to integrate the plugin with Magento?
thanks
sparkitMemberthanks for the reply!
sure, that would be a start: i think i can hack some of the functions from a plugin called CRM4wordpress to begin with, but as i’m a tinkerer rather than a programmer it might be safer if someone more experienced is giving me some input!
-
AuthorPosts