I am writing a plugin that grabs extra information that wassup currently does not store. I want this plugin to work in conjunction with wassup. In order to do this, it would be extremely helpful to have access to the insert ID of the last record entered by wassup. This would need to be accessible outside of wassup, possibly stored in the session, in order to get it without touching the wassup code. Is this possible at all?
3rd Party Extending Wassup
(3 posts) (3 voices)-
Posted 3 years ago #
-
Hi MikeM,
Wassup no longer uses session to track visitor hits, but you can access 'wassup_id' outside of wassup by reading the 'wassup' cookie. Use this PHP syntax to get it:`if (isset($_COOKIE['wassup'])) {
$wassup_cookie = explode('::',$_COOKIE['wassup']);
$wassup_id = $wassup_cookie[0];
}`'wassup_id' is not unique and can span several records, depending on the number of pages visited by the user.
There is a unique record id, called
idfor each wassup record. It is an auto-increment value in MySql. If you want the very last record entered in wassup you can select the largest value:$last_id = $wpdb->get_var("select max(id) from wp_wassup");If you want the last record for current visitor (with a wassup_id cookie):
$last_id = $wpdb->get_var("select max(id) from wp_wassup where wassup_id = $wassup_id");You should also know that there is no 'wassup' cookie if the browser reject cookies. Wassup regenerates 'wassup_id' for each hit in this case. You can repeat the same formula to get 'wassup_id' in your plugin too. It's a complex-looking formula so I won't type it here. Look for
$temp_idin the 'wassupPrepend' function in wassup.php to find it.I look forward to seeing your plugin.
-Helene D.-Helene D.
http://techfromhel.webege.comPosted 2 years ago # -
Helene,
I was wondering if the persistent cookie usage can be modified to use SESSION cookies instead. Was there a reason why $_COOKIE was used instead of $_SESSION? and in your opinion would it be doable?
- Sid.
Posted 2 years ago #
Reply
You must log in to post.