[Xen-Soluce] SEO Optimization

[Xen-Soluce] SEO Optimization [Paid] 2.6.3 Fix 3

No permission to buy (€20.00)
Some minutes ago i have inserted title and text for a thread.
After saving i had the idea to change it.
Funny, funny, there was nothing saved! Also there was no error-message in the acp.
Then i have checked the table xf_thread with phpMyAdmin and funny, funny i have found really a lot of threads with this SEO-Data:

{"meta_title":"","meta_description":"","meta_robots":"","open_graph":"","twitter_card":"summary","canonical_url":""}


Please find out, how this is possible. You may have problems in your script or the script has problems with typical other addons. The forums i have tested the SEO-Addon are demo-forums with less addons, but with all the stuff you typically would use in every forum.

Also please check, why something is saved, when there is no content? Why i should fill the database with
{"meta_title":"","meta_description":"","meta_robots":"","open_graph":"","twitter_card":"summary","canonical_url":""}

This makes no sense!
Hello, this is strange yes. Thanks for reporting this, we'll look at it quickly!

Regards, SyTry
 
I cant update an existing prefix.
I have deactivated XON's MultiPrefix
I have deactivated PrefixEssentials
=> no success, still get that error


I have found the problem. It is Tag Essentials

You may want to talk to that programer, please?
 
Last edited:
I cant update an existing prefix.
I have deactivated XON's MultiPrefix
I have deactivated PrefixEssentials
=> no success, still get that error

I have searched for $form->basicEntitySave($prefix, in a lot of addons,
but cant find anything.

If i search for saveAdditionalData i find a lot of functions, but they dont work with basicEntitySave
I dont need any robots-stuff, so i will comment // $form->basicEntitySave($prefix, $prefixRobots); to get rid of this error.
We'll fix that too, thanks
 
You may tell me later, what's the problem, please, because here it looks ok:

Code:
[_values:protected] => Array
        (
            [prefix_id] => 178
            [prefix_group_id] => 13
            [display_order] => 24
            [materialized_order] => 60
            [css_class] => label label--primary
            [allowed_user_group_ids] => -1
            [tagess_tags] => a:2:{i:0;s:4:"test";i:1;s:5:"test2";}
            [xs_seo_meta_robots] => noindex,nofollow
 
Ok, the problem can be solved with
XenSoluce\SEOOptimization\XF\Admin\Controller\ThreadPrefix
set to 9 instead of 10.

I have used a lot of time to find that.
You may want so kind please to tell me, why this is happen.

Why we dont get any error in combination with the "tag essentials"?
And what does "tag essentials" to null something and produce this error?

This error comes while both programers have done a good job or because something is done bad somewhere?
 
Here is code from tag essentials, not using

$form = parent::saveAdditionalData($form, $prefix);

I have no real idea about all of this, so i try to understand and learn.
This means that "tag essentials" does something without fetching vars from the rest of the world?

Then the "tag essentials" should have this
$form = parent::saveAdditionalData($form, $prefix);
...
return $form;

instead of
parent::saveAdditionalData($form, $prefix);

?


Code:
    protected function saveAdditionalData(FormAction $form, \XF\Entity\AbstractPrefix $prefix)
    {
        /** @var \AVForums\TagEssentials\XF\Repository\Tag $tagRepo */
        $tagRepo = $this->repository('XF:Tag');

        $tagList = $this->filter('tagess_tags', 'str');
        $tags = new ArrayCollection($tagRepo->splitTagList($tagList));
        $tags = $tags->filter(function ($tag) use ($tagRepo)
        {
            if ($tagRepo->isValidTag($tag))
            {
                return true;
            }

            return false;
        });

        if ($tags->count())
        {
            $tagsArr = $tags->toArray();
            $existingTags = $this->finder('XF:Tag')
                ->where('tag', $tagsArr)
                ->fetch();

            /** @var \AVForums\TagEssentials\XF\Entity\Tag $existingTag */
            foreach ($existingTags AS $existingTag)
            {
                $tagsArr = array_diff($tagsArr, [$existingTag->tag]);
            }

            $form->apply(function() use ($form, $tagsArr, $tags, $prefix) {
                foreach ($tagsArr AS $newTagToCreate)
                {
                    /** @var \AVForums\TagEssentials\XF\Entity\Tag $tag */
                    $tag = $this->em()->create('XF:Tag');
                    $tag->tag = $newTagToCreate;
                    $tag->permanent = true;
                    $tag->save(true, false);
                }

                $prefix->tagess_tags = $tags->toArray();
                $prefix->save(true, $form->isUsingTransaction() ? false : true);
            });
        }
        else
        {
            $prefix->tagess_tags = [];
        }

        parent::saveAdditionalData($form, $prefix);
    }
 
Yes, this works for me to change the "tag essentials" like written above.

Code:
    protected function saveAdditionalData(FormAction $form, \XF\Entity\AbstractPrefix $prefix)
    {

        $form = parent::saveAdditionalData($form, $prefix);

        /** @var \AVForums\TagEssentials\XF\Repository\Tag $tagRepo */
        $tagRepo = $this->repository('XF:Tag');

        $tagList = $this->filter('tagess_tags', 'str');
        $tags = new ArrayCollection($tagRepo->splitTagList($tagList));
        $tags = $tags->filter(function ($tag) use ($tagRepo)
        {
            if ($tagRepo->isValidTag($tag))
            {
                return true;
            }

            return false;
        });

        if ($tags->count())
        {
            $tagsArr = $tags->toArray();
            $existingTags = $this->finder('XF:Tag')
                ->where('tag', $tagsArr)
                ->fetch();

            /** @var \AVForums\TagEssentials\XF\Entity\Tag $existingTag */
            foreach ($existingTags AS $existingTag)
            {
                $tagsArr = array_diff($tagsArr, [$existingTag->tag]);
            }

            $form->apply(function() use ($form, $tagsArr, $tags, $prefix) {
                foreach ($tagsArr AS $newTagToCreate)
                {
                    /** @var \AVForums\TagEssentials\XF\Entity\Tag $tag */
                    $tag = $this->em()->create('XF:Tag');
                    $tag->tag = $newTagToCreate;
                    $tag->permanent = true;
                    $tag->save(true, false);
                }

                $prefix->tagess_tags = $tags->toArray();
                $prefix->save(true, $form->isUsingTransaction() ? false : true);
            });
        }
        else
        {
            $prefix->tagess_tags = [];
        }

        //parent::saveAdditionalData($form, $prefix);
        return $form;
    }
 
But you may want to view another small thing, please.

When a prefix is new and no "xs_seo_meta_robots" chosen the field
xf_thread_prefix.xs_seo_meta_robots is NULL

When you change the value to something (and save) and change it back to "Default" (and save)
the value of
xf_thread_prefix.xs_seo_meta_robots is ""
 
Yes, this works for me to change the "tag essentials" like written above.

Code:
    protected function saveAdditionalData(FormAction $form, \XF\Entity\AbstractPrefix $prefix)
    {

        $form = parent::saveAdditionalData($form, $prefix);

        /** @var \AVForums\TagEssentials\XF\Repository\Tag $tagRepo */
        $tagRepo = $this->repository('XF:Tag');

        $tagList = $this->filter('tagess_tags', 'str');
        $tags = new ArrayCollection($tagRepo->splitTagList($tagList));
        $tags = $tags->filter(function ($tag) use ($tagRepo)
        {
            if ($tagRepo->isValidTag($tag))
            {
                return true;
            }

            return false;
        });

        if ($tags->count())
        {
            $tagsArr = $tags->toArray();
            $existingTags = $this->finder('XF:Tag')
                ->where('tag', $tagsArr)
                ->fetch();

            /** @var \AVForums\TagEssentials\XF\Entity\Tag $existingTag */
            foreach ($existingTags AS $existingTag)
            {
                $tagsArr = array_diff($tagsArr, [$existingTag->tag]);
            }

            $form->apply(function() use ($form, $tagsArr, $tags, $prefix) {
                foreach ($tagsArr AS $newTagToCreate)
                {
                    /** @var \AVForums\TagEssentials\XF\Entity\Tag $tag */
                    $tag = $this->em()->create('XF:Tag');
                    $tag->tag = $newTagToCreate;
                    $tag->permanent = true;
                    $tag->save(true, false);
                }

                $prefix->tagess_tags = $tags->toArray();
                $prefix->save(true, $form->isUsingTransaction() ? false : true);
            });
        }
        else
        {
            $prefix->tagess_tags = [];
        }

        //parent::saveAdditionalData($form, $prefix);
        return $form;
    }
@Xon could you have a look, please?
 
Hello,

But you may want to view another small thing, please.

When a prefix is new and no "xs_seo_meta_robots" chosen the field
xf_thread_prefix.xs_seo_meta_robots is NULL

When you change the value to something (and save) and change it back to "Default" (and save)
the value of
xf_thread_prefix.xs_seo_meta_robots is ""
Does this create a bug?

Because it comes back to the same thing.


Yes, this works for me to change the "tag essentials" like written above.

Code:
    protected function saveAdditionalData(FormAction $form, \XF\Entity\AbstractPrefix $prefix)
    {

        $form = parent::saveAdditionalData($form, $prefix);

        /** @var \AVForums\TagEssentials\XF\Repository\Tag $tagRepo */
        $tagRepo = $this->repository('XF:Tag');

        $tagList = $this->filter('tagess_tags', 'str');
        $tags = new ArrayCollection($tagRepo->splitTagList($tagList));
        $tags = $tags->filter(function ($tag) use ($tagRepo)
        {
            if ($tagRepo->isValidTag($tag))
            {
                return true;
            }

            return false;
        });

        if ($tags->count())
        {
            $tagsArr = $tags->toArray();
            $existingTags = $this->finder('XF:Tag')
                ->where('tag', $tagsArr)
                ->fetch();

            /** @var \AVForums\TagEssentials\XF\Entity\Tag $existingTag */
            foreach ($existingTags AS $existingTag)
            {
                $tagsArr = array_diff($tagsArr, [$existingTag->tag]);
            }

            $form->apply(function() use ($form, $tagsArr, $tags, $prefix) {
                foreach ($tagsArr AS $newTagToCreate)
                {
                    /** @var \AVForums\TagEssentials\XF\Entity\Tag $tag */
                    $tag = $this->em()->create('XF:Tag');
                    $tag->tag = $newTagToCreate;
                    $tag->permanent = true;
                    $tag->save(true, false);
                }

                $prefix->tagess_tags = $tags->toArray();
                $prefix->save(true, $form->isUsingTransaction() ? false : true);
            });
        }
        else
        {
            $prefix->tagess_tags = [];
        }

        //parent::saveAdditionalData($form, $prefix);
        return $form;
    }

Can you test this:

Code:
    protected function saveAdditionalData(FormAction $form, \XF\Entity\AbstractPrefix $prefix)
    {

        /** @var \AVForums\TagEssentials\XF\Repository\Tag $tagRepo */
        $tagRepo = $this->repository('XF:Tag');

        $tagList = $this->filter('tagess_tags', 'str');
        $tags = new ArrayCollection($tagRepo->splitTagList($tagList));
        $tags = $tags->filter(function ($tag) use ($tagRepo)
        {
            if ($tagRepo->isValidTag($tag))
            {
                return true;
            }

            return false;
        });

        if ($tags->count())
        {
            $tagsArr = $tags->toArray();
            $existingTags = $this->finder('XF:Tag')
                ->where('tag', $tagsArr)
                ->fetch();

            /** @var \AVForums\TagEssentials\XF\Entity\Tag $existingTag */
            foreach ($existingTags AS $existingTag)
            {
                $tagsArr = array_diff($tagsArr, [$existingTag->tag]);
            }

            $form->apply(function() use ($form, $tagsArr, $tags, $prefix) {
                foreach ($tagsArr AS $newTagToCreate)
                {
                    /** @var \AVForums\TagEssentials\XF\Entity\Tag $tag */
                    $tag = $this->em()->create('XF:Tag');
                    $tag->tag = $newTagToCreate;
                    $tag->permanent = true;
                    $tag->save(true, false);
                }

                $prefix->tagess_tags = $tags->toArray();
                $prefix->save(true, $form->isUsingTransaction() ? false : true);
            });
        }
        else
        {
            $prefix->tagess_tags = [];
        }

        //parent::saveAdditionalData($form, $prefix);
        return  parent::saveAdditionalData($form, $prefix);
    }

Regards, CRUEL-MODZ
 
1. I really dont know what is the fidderence between NULL and empty.
Maybe it is only cosmetic. But for you it is only one change for the next version "update = NULL instead "".

2. Is there a difference in code? So i need to compare both codes now ...
 
1. I really dont know what is the fidderence between NULL and empty.
Maybe it is only cosmetic. But for you it is only one change for the next version "update = NULL instead "".
It is exactly the same thing, and doing an update for that is useless.

2. Is there a difference in code? So i need to compare both codes now ..
Yes the code changes, instead of making :
$form = parent::saveAdditionalData($form, $prefix);
the code...
return $form;

it makes :
return parent::saveAdditionalData($form, $prefix);
It's pretty much the same thing, but @Xon he put: parent::saveAdditionalData($form, $prefix); at the end of the code it was probably for a reason
 
It is exactly the same thing, and doing an update for that is useless.
I have not asked for this (i hope); but you may can do it, if and when you do the next update.
It is just cosmetic and looks nice and clean, when i watch the table in pma. And also it gives back the feeling, that all the time searching for problems in addons from other people is sometimes honored just with a small "thank you, i will edit it with the next update".
 
It would be a really nice idea, if you want to care also for the meta_title of overview, please.
XFRM_resources needs to be something short for me. But the meta_title should have the usual length.
So this must be separated from each other.
 
It would be a really nice idea, if you want to care also for the meta_title of overview, please.
XFRM_resources needs to be something short for me. But the meta_title should have the usual length.
So this must be separated from each other.
Hello, do you have an exemple please ? Something like this ?

Regards, SyTry
 
the phrase xfrm_resources is used as meta_title for overview, but also as title for the page overview and somewhere else.

A good title for the page could be

Personal ads

The meta title should be something like:

Best personal ads for boys and girls from New York City some chars more


So make a template mod for xfrm_overview; replace phrase xfrm_overview with xfrm_overview_meta_title and add the phrase.

Or add another field above the resources description to save the meta_title somewhere.
 
Top Bottom