Drupal: cannot add fields to a View after site move - drupal

I have already received some help on this from other posts in StackOverflow, but there is a specific refinement that does not seem to be addressed.
I cloned a Drupal Site.
Everything seemed to be working just fine as I worked on CSS per client request.
Then along came a client request that involved changes to the fields in a View. No custom field was available in the dialog box - only the default fields. An error showed up at the top of the page: Notice: unserialize(): Error at offset 421 of 16415 bytes in views_db_object->load_row() (line 2251 of /var/www/sitename/html/sites/all/modules/views/includes/view.inc).
There had been a change that affected Content Types, but I did not realize that one bad View would cause all of them to fail.
It was suggested that I look at another StackOverflow question about this error. One reply said to remove potentially problem Views. When I did that, the error went away.
I can now make new Views and have a list of all the available fields, but once I save the View, it goes back to only showing the default fields. There is something else wrong, but I don't know what it is.
Drupal is always a new puzzle to solve!

Related

Drupal Embedded views not working correctly

I recently took over a site from someone else at a new company. Having never used Drupal before, updating things has been a bit cumbersome. There were some outstanding security updates that I applied(but I haven't updated the core yet). Anyway, after doing this, the calls to views_embeded_view have not been working. For example:
print views_embed_view('news_block');
Will break the links(by using the title, rather than alias for the link), or it will link correctly, but not follow the paging rules I have set(show 1 page, 6 items per page) instead it shows 10 items and has links for other pages.
I am not sure if the update has anything to do with it, but it seems likely. Would updating the core resolve this issue potentially?
The first argument of views_embed_view is view name, the second one is display id. If display_id is not provided, 'default' is used. Make sure that you are displaying the correct display. (i.e. default can be configured differently than some other display which you actually wish to see)

Drupal : Block doesn't show up on specific content-type page

I need your help for a problem that seems childish but that I can't solve.
I would like to activate a block (that is already activated for other content-types pages and works just fine) to show it up on a new content-type. I just checked the box in admin->structure->block->configure->visibility parameters for that specific content-type just like I did for others. However, it doesn't show up.
Here is a screenshot of block parameters config (you never know ^^).
This block is located in sidebar_second region. So I checked with dpm() if this region was set in both content-types.
Here I can see that is actually set for my content-type basic page where the block shows up well.
But here I see that my region doesn't exist at all and thereby my block doesn't appear.
I created a new test block and located it in sidebar_second region as well to determine if the problem is the specific block itself or the content-type page... Apparently, I guess it is the second solution because it doesn't show up neither.
Also, I tried to locate my blocks into the sidebar_first region (that already exists for my content-type testimonial). Unfortunately, it doesn't work neither. Of course, it works well on content-type basic page...
To make sure the page code is not overriden in my testimonial.module or template, I checked twice the hooks I implemented and all my templates files... I found nothing that could cause that problem.
Eventually, I googled my problem and found that bug report (closed because cannot be reproduced): https://drupal.org/node/1777072 but I think that it would be very unlucky as it happens...
To choose, it surely is a mistake that I don't see rather than an uber rare bug that happened to 10 people in the world xD
That's why I need your help, รด stackoverflow people!
My first though it that the testimonial content type could be using a different page template to the basic page content type.
You will need the line:
<?php echo render($page['sidebar_first']); ?>
In the page template used by testimonial.
Hmm, actually I'm not at all convinced that this is the correct solution but I'll post just in case it helps...
I just wanted you to know that I figure it out.
Indeed, my function hook_node_view() implemented menu_set_active_item("testimonial") to solve a navigation detail (to force highlighting a menu item...). However, it modified the q variable in URL and Drupal didn't know anymore that the page was actually a node type testimonial (and thought it was actually a View).
Thereby, my block couldn't appear because it was supposed to show up on node type testimonial (and not on a View).
So, I had to save the true nature of my page in a variable using menu_get_active_trail() before implementing menu_set_active_item().
Eventually, I had to pass this variable in my hook_block_view() to display the block.
I am sorry for not having given you all the information that was necessary to answer my question. I thought the custom code wasn't very suspect but I was wrong. I'm still a junior Drupal developer and I didn't know what menu_set_active_item() method did exactly. Thanks however and have a great weekend!

Cannot change og_type

I just replaced a tumblr website for a client with a brand new Wordpress site. And when running it through the Facebook debugger, I get this error:
The object at 'http://example.com/' previously had type 'tumblr-feed:tumblelog' and cannot be changed to an object of type 'website' to avoid data corruption of existing actions.
I Googled "Cannot change og_type" (in quotes) and got literally zero results (well now it seems there are results stemming from this question). Am I really doomed to Facebook data mismatch?
Per the error message
... cannot be changed to an object of type 'website' to avoid data corruption of existing actions.
If the og:type were changed for a URL, any existing user posts linking to it or sharing it, any Open Graph actions referencing it, as well as any likes of the URL would become broken and the user's profiles would be missing content they'd posted before.
I don't believe there's any way around this, as it's an intentional restriction to avoid breaking existing posts, likes, actions, etc referencing a URL. If the posts were broken, content would be removed from or mangled on the user's timeline.
A possible workaround if you want to have a 'new' object at that URL is to use my instructions in this answer about moving URLs to put a Like button on the URL you're trying to change (let's call it A), but pointing to a slightly different, new URL (let's call it B) , and then use the redirect mechanism in my answer to bounce users landing at URL B back to A, but serve the metdata describing 'A' on URL B if the Facebook crawler accesses it
Does the client's site have more than 10,000 likes? If so, Facebook doesn't allow og:type to be changed.
You can update the attributes of your page by updating your page's tags. Note that og:title and og:type are only editable initially - after your page receives 50 likes the title becomes fixed, and after your page receives 10,000 likes the type becomes fixed. These properties are fixed to avoid surprising users who have liked the page already. Changing the title or type tags after these limits are reached does nothing, your page retains the original title and type.
Here's the link to the Open Graph documentation. :)
I would reccomend using the Open Graph Debugger to check what facebook really sees and if facebook eventually has a cached version of your site. (you find hte debugger here: https://developers.facebook.com/tools/debug)
NOte that it doesnt say og:type - it says og_type
This is hitting me too since my og:type is set to "shamrockirishbar:shamrockirishbar" BUT the linter is saying og_type (of which there is none in my meta data) is set to "website".
enter link description here

Drupal Multi-step form breaks with node save

I have a custom multi-step form that I add to certain node type content via hook_nodeapi. It is working great, with one exception.
During testing, I've found that when I am in mid-form (say, step 2 of 6) and update the node in another browser tab, my form reverts to step 1 when I try to proceed to the next step. Similarly, when an AHAH event occurs, I get an error and the form disappears altogether. The error suggests there is a problem with retrieving the form from cache after a node update, as it's not able to retrieve the form parameters.
Have you encountered this behaviour before, and/or do you have any suggestions on how I might go about fixing it? It isn't a huge problem as these nodes likely won't be updated too often on the production side, but it would still be a significant nuisance to those it does affect.
Edit: Thanks for your response. Unfortunately I can't contain this form within a block. It must be within the node content itself. Upon further testing I noted that other users thankfully aren't affected. It is only the user that updates the node while in mid-form that is affected. As this is extremely unlikely to happen on the production site, the impact of such an occurrence would be minor, and I have no time at the moment to explore this further, I'm going to move on with this behaviour unexplained for now. But if anyone can point out why this is occurring, I'd appreciate it.
Well, have just tried your situation based on multistep form described here - http://zgadzaj.com/basic-drupal-multipart-form-example-with-previous-and-next-buttons - but put in the block and displayed on node page, and even if I edit this node in a different tab, I still can navigate between all form steps on the original tab, keeping all already submitted values. So I'd say it all probably depends how your form is being built...

Drupal - Migrating to new server

I have a fairly new drupal installation with a few hundred nodes. I moved it from the development server to the production server.
However, when I opened my homepage, it says page not found. After checking all my links, it seems that I can't get to any of my content. They exist in the node database, as well as the content type tables. I verified that all my URL aliases are also in place. In most cases, I can still see all the information from views I had created, but when clicking to see the full node view, I get the "Page not found".
I did trim all my cache tables before importing to reduce the size of the DB. Has anyone had these symptoms before? Perhaps there is a particular table, that when truncated, will lead to this problem?
**Update: Imported my revision table again, and presto - Although my content came back, I'm still having a sort of permissions problem. When an anonymous visitor comes to the site, they are told they don't have permission to see items like content type "Page", yet in user permissions, everything looks good (definitely good before migration) perhaps another deleted table?
Yes, node content information is in the revisions table, not the node table. You REALLY need the revisions table. I assume you can just remigrate again, this time without truncating revisions.
if table is broken, it shouldn't show "Page not found". It may show that sql error that table or column doesn't exists.
Try troubleshoot in http://drupal.org/node/201875 (you will see Page Not Found links in middle).
Also may be you use some redirecting in your node theming, check this.
p.s. In any case, node saving touch 2 tables: node and node_revisions

Resources