Using H&M Webhelp with Wordpress, and the H&M Wordpress plugin

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
Pshooter
Posts: 18
Joined: Tue Aug 19, 2008 3:55 am

Using H&M Webhelp with Wordpress, and the H&M Wordpress plugin

Unread post by Pshooter »

This was the situation - I had a Wordpress site that I wanted people to register on to access H&M webhelp, using the H&M plugin.

However, people were able to access the H&M Webhelp portion directly, without having to log into the Wordpress site first. This was not what I wanted.

By adding some code to the head of all the Webhelp output, I was able to prevent people from directly accessing the Webhelp, and instead they had to access it through the Wordpress site and the H&M Plugin.

Code: Select all

<?php
# Make sure the user has logged in to our WordPress site:
$wpLoggedIn = false;
foreach ($_COOKIE as $key => $value):
  if (stripos($key, 'wordpress_logged_in_') === 0):
    $wpLoggedIn = true;
    break;
  endif;
endforeach;
if(!$wpLoggedIn):
  Header("Location: /member-login/");
endif;
?>
I tried to add this code using the Premium Pack Toolbox, but it didn't work for me, so I just added the code to the head of each topic file outside of H&M. Everything seems to work perfectly - the H&M-created Webhelp accessed through the plugin still works just as it did, and people trying to access the Webhelp files directly are instead redirected to the sign-in page of the Wordpress site.

I am not a coder, and I had a lot of outside assistance in getting to this point, but I wanted to share my results here because I've been trying to do this for a long time and finally have hit upon a solution.
User avatar
Tim Green
Site Admin
Posts: 23184
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Using H&M Webhelp with Wordpress, and the H&M Wordpress plugin

Unread post by Tim Green »

Thanks for posting this, interesting!

You should actually be able to add this with Toolbox so that you don't need to edit your output files every time you publish. First you need to make sure the advanced functions in Toolbox are activated. Open Toolbox, and without loading a skin or project select Preferences in the Edit menu and activate the checkbox for the advanced functions.

Then open the skin you want to edit and select the button for the Page Template. Add the code to the template in the same place you have been adding it in your HTML pages.

It would be helpful if you could let me know where you have been adding it. Then we can consider making this an option for the skins. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Pshooter
Posts: 18
Joined: Tue Aug 19, 2008 3:55 am

Re: Using H&M Webhelp with Wordpress, and the H&M Wordpress plugin

Unread post by Pshooter »

Hi Tim,

It's just jammed at the very, very top.

Code: Select all

<?php
# Make sure the user has logged in to our WordPress site:
$wpLoggedIn = false;
foreach ($_COOKIE as $key => $value):
  if (stripos($key, 'wordpress_logged_in_') === 0):
    $wpLoggedIn = true;
    break;
  endif;
endforeach;
if(!$wpLoggedIn):
  Header("Location: /member-login/");
endif;
?>
<!DOCTYPE html>
<html>
	<head>
	<!-- Help+Manual Premium Pack Version 3.43 (c) 2015-2018 by Tim Green all rights reserved -->
Thanks for the tip on adding that code to the skin. I couldn't get that to work before but it does!
Post Reply