Digital Point Ad Positioning

Digital Point Ad Positioning 1.3.0b

No permission to download

cclaerhout

Well-known member
@XxUnkn0wnxX
#466, #469 & #477.

@digitalpoint
  • I don't understand why setting a session is a bad thing even for an external request. You can still use this kind of code if you don't want the $this->_request:
    PHP:
      protected function _setupSession($action)
       {
         XenForo_Session::startPublicSession();
       }
  • It's not that I don't want to add supplementary code in my code, but this would apply to copy the all get method to customize it. That's not very sexy.
  • If you want don't want to create a session, at least disable listeners for other addons:
    PHP:
      protected function _preDispatchFirst($action)
       {
         XenForo_CodeEvent::removeListeners();
       }
 

XxUnkn0wnxX

Active member
@cclaerhout i read the posts didn't not tell me how to fix the issue. coding not my area...

even the stuff with BBCODES u told me i sort of get but for me different languages just don't make much sense to me.

i spent a whole month once trying to make a calculator or a timer in visual basics once never understood a thing. for me i need to understand the full thing the word, function and all possibility that function is used with and why the function works the explanation behind that as well. in other words each string of code needs to be full broken down to total noob language for me to understand it...
 

cclaerhout

Well-known member
@cclaerhout i read the posts didn't not tell me how to fix the issue. coding not my area...
The posts shows you we are actually talking about how to solve the issue, so wouldn't it too much to ask you to wait and avoid asking twice the same thing. Thanks.

even the stuff with BBCODES u told me i sort of get but for me different languages just don't make much sense to me.
This isn't the thread for this. I told you, if you have a specific question, you can ask, but in the proper thread and after having tried by yourself first.

for me i need to understand the full thing the word, function and all possibility that function is used with and why the function works the explanation behind that as well
That's why I gave you all elements to understand by yourself (and even the full Bb Code code that you just need to copy/paste in your template !). Note these elements are templates functions that you can use to manage your own website. So learning them will be useful for you to customize templates and css.

i spent a whole month once trying to make a calculator or a timer in visual basics once never understood a thing.
Same thing occurs for me many years ago when I was curious enough to open a book about Assembly. I immediately closed it when I read subtract numbers was not directly possible. But it doesn't mean you can't be curious about other things.
 

Superfluous

Member
Just tested this - it seems to put an ad inside/after the first post in every page - what advantage does this add on have over a simple conditional statement doing the same thing?
 

digitalpoint

Well-known member
Ah, I only show ads to guests so I've been using incognito windows to test and it always appears as the first post, even when it anchor/hash tags to a specific post. Is this normal?
Yep... it's based on the unread message the user is on. If you aren't logged in as a user, there is no "unread" tracker.
 

Superfluous

Member
Yep... it's based on the unread message the user is on. If you aren't logged in as a user, there is no "unread" tracker.

No worries. If you make an update in the future it might be a cool function to enable ads on anchored posts (for instance when the likes of "#post-7495718" is at the end of the url the advert will be in post 7495718).

When I get a chance I think I'm going to try implement some Javascript myself for this as my CPMs dropped for 'in post' ads since I moved from vB.
 

digitalpoint

Well-known member
Yep... and making extra HTTP requests/AJAX calls and adding JavaScript complexity to it all really isn't worth it (which is why it doesn't already do all that).
 

Superfluous

Member
Yep... and making extra HTTP requests/AJAX calls and adding JavaScript complexity to it all really isn't worth it (which is why it doesn't already do all that).

You're probably much more experienced than me with this kinda thing and may have figured out why this won't work, but I was thinking of having an empty placeholder <div> under each post with the ID of each post, a simple piece of javascript in the header will read the hash ID and populate the appropriate <div> with the ad code on the fly - no extra http requests required. I'll play about tomorrow and let you know if it works.

(Sorry for hogging up your thread by the way!).
 

Superfluous

Member
Had a play about this morning and got it working, without any extra http requests (I think!). I placed a blank div inside the ad_message_below template, with an ID for each message.

Code:
<div id="ad-{$post.post_id}"></div>

I already place an advert on the first post of each page, I put this in a div with an ID of 'advert-post' with the standard conditionals.

I append this bit of Javascript to the bottom of the thread_view template.

Code:
<script>
    if (window.location.hash) {
        var hash = window.location.hash.substring(1).replace("post-", "");
        var newAdvertPosition = document.getElementById("ad-" + hash);
        var oldAdvertPosition = document.getElementById("advert-post");

        while (oldAdvertPosition.childNodes.length > 0) {
            newAdvertPosition.appendChild(oldAdvertPosition.childNodes[0]);
        }
    }
</script>

Which basically checks to see if there is a hash tag, if there is it gets the First Post advert and moves it to the anchor tagged post.

That's basically what I wanted to achieve - my only slight worry is if it's against Adsense TOS to move adverts after page load (the net doesn't seem to have a definitive answer, but I assume it's fine as responsive designs have changed the game).
 

Dannymh

Active member
The usergroup permissions do not seem to be working for me. It seems to be ignoring the option of the user group
 

digitalpoint

Well-known member
I would triple check your settings. Really doubt it randomly wouldn't work just for you. :)

If you post a screenshot of your settings, it would be useful.
 

Dannymh

Active member
Does it only look at the primary group of a user or is it looking at the additional groups?

It seems to only work on the primary group of a user.
I'll take a dive into the code later to confirm
 

Dannymh

Active member
The option for hiding from a specific usergroup (I.e. Don't show to usergroup.)
I've disabled it for now and am currently on my phone whilst nursing a baby so can't get the specific setting /screenshot but will as soon as I can
 
Top